commit 9c9de75826198b3d420355620c5ef61fda3ebe98 Author: root Date: Fri Jul 7 14:57:59 2006 +0000 1.1.10 release git-svn-id: svn://192.168.202.10@1 3d104415-ff17-0410-8863-d5cf3c621b8a diff --git a/ADMIN_adjust_GMTnow_on_leads.pl b/ADMIN_adjust_GMTnow_on_leads.pl new file mode 100644 index 0000000..8779cae --- /dev/null +++ b/ADMIN_adjust_GMTnow_on_leads.pl @@ -0,0 +1,670 @@ +#!/usr/bin/perl + +# ADMIN_adjust_GMTnow_on_leads.pl +# +# program goes throught the vicidial_list table and adjusts the gmt_offset_now +# field to change it to today's offset if needed because of Daylight Saving Time +# +# run every time you load leads into the vicidial_list table +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 50810-1540 - Added database server variable definitions lookup +# + +$MT[0]=''; + +### 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 [-q] = quiet\n [-t] = test\n [--debug] = debugging messages\n\n"; + } + else + { + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t|--test/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} + +if ($DB) {print "STARTING TIME ZONE DAYLIGHT SAVING TIME CALCULATION SCRIPT\n\n\n\n";} + +### end parsing run-time options ### + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$secX = time(); +# $secX = '1079989363'; # epoch for March 22, 2993 +# $secX = '1097989363'; # epoch for October 17, 2004 + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + ### Grab Server values from the database + $stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + $stmtA = "select distinct phone_code from vicidial_list;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + @phone_codes=@MT; + $phone_codes_list='|'; + while ($recordA = $iterA->each) + { + $phone_codes[$rec_countY] = $recordA->[0]; + $phone_codes_ORIG[$rec_countY] = $recordA->[0]; + $phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi; + + # if ( ($phone_codes_list !~ /\|$phone_codes[$rec_countY]\|/) && (length($phone_codes[$rec_countY]) > 0) ) + # { + # $phone_codes_list .= "$phone_codes[$rec_countY]|"; + # } + + if ($DBX) {print "|",$recordA->[0],"|","\n";} + $rec_countY++; + } + } + + if ($DB) {print " - Unique Country dial codes found: $rec_countY\n";} + + + open(codefile, "/home/cron/phone_codes_GMT.txt") || die "can't open /home/cron/phone_codes_GMT.txt: $!\n"; + @codefile = ; + close(codefile); + +$ep=0; $ei=0; $ee=0; +$d=0; +foreach (@phone_codes) + { + $match_code = $phone_codes[$d]; + $match_code_ORIG = $phone_codes_ORIG[$d]; + + if ($DB) {print "\nRUNNING LOOP FOR COUNTRY CODE: $match_code\n";} + + $e=0; + foreach (@codefile) + { + chomp($codefile[$e]); + if ($codefile[$e] =~ /^$match_code\t/) + { + @m = split(/\t/, $codefile[$e]); + $area_code = $m[2]; + $area_state = $m[3]; + $area_GMT = $m[4]; $area_GMT =~ s/\+//gi; $area_GMT = ($area_GMT + 0); + $area_GMT_method = $m[6]; + if ($area_code =~ /S/) # look for state override flag in areacode field + { + $area_code =~ s/\D//gi; + $AC_match = " and phone_number LIKE \"$area_code%\" and state='$area_state'"; + if ($DB) {print " AREA CODE STATE OVERRIDE: $codefile[$e]\n";} + } + else + { + if ($area_code =~ /\*/) {$AC_match = '';} + else {$AC_match = " and phone_number LIKE \"$area_code%\"";} + } + if ($DBX) {print "PROCESSING THIS LINE: $codefile[$e]\n";} + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + $rec_countZ=0; + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + $rec_countZ = $recordA->[0]; + } + } + if (!$rec_countZ) + { + if ($DB) {print " IGNORING: $codefile[$e]\n";} + $ei++; + } + else + { + $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) && ($area_GMT_method =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &USA_dstcalc; + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + + if ($AC_processed) + { + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and gmt_offset_now != '$area_GMT';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + $rec_countW=0; + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + $rec_countW = $recordA->[0]; + } + } + if (!$rec_countW) + { + if ($DB) {print " ALL GMT ALREADY CORRECT FOR : $match_code_ORIG $area_code $area_GMT\n";} + $ei++; + } + else + { + $stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and gmt_offset_now != '$area_GMT';"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + $Prec_countW = sprintf("%8s", $rec_countW); + if ($DB) {print " $Prec_countW records in $match_code_ORIG $area_code updated to $area_GMT\n";} + $ee++; + # sleep(1); + } + } + } + + $ep++; + } + else + { + if ($DBX) {print " IGNORING: $codefile[$e]\n";} + $ei++; + } + $e++; + } + + $d++; + } + + + + $dbhA->close; + +if($DB){print "\nDONE\n";} + +exit; + + + + +sub USA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +#********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $USA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USA_DST=0; return 0; + } else { + $USA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USA_DST=0; return 0; + } else { + $USA_DST=1; return 1; + } + } + } else { + $USA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $USA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; return 1; + } else { + $USA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; return 1; + } else { + $USA_DST=0; return 0; + } + } + } else { + $USA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/ADMIN_area_code_populate.pl b/ADMIN_area_code_populate.pl new file mode 100644 index 0000000..d47cdea --- /dev/null +++ b/ADMIN_area_code_populate.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl +# ADMIN_area_code_populate.pl version 1.1 for Perl +# +# Copyright (C) 2006 Joe Johnson,Matt Florell LICENSE: GPLv2 +# +# Description: +# server application that allows load areacodes into to asterisk list database +# + +use lib ".\\",".\\libs", './', './libs', '../libs', '/usr/local/perl_TK/libs', 'C:\\AST_VICI\\libs'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # needed to have perl sleep in increments of less than one second +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbh = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$slash_star = '\*'; + + open(codefile, "/home/cron/phone_codes_GMT.txt") || die "can't open /home/cron/phone_codes_GMT.txt: $!\n"; + @codefile = ; + close(codefile); + $pc=0; + $ins_stmt="insert into vicidial_phone_codes VALUES "; + foreach (@codefile) { + @row=split(/\t/, $codefile[$pc]); + $row[7] =~ s/\r|\n|\t| $//gi; + $row[6] =~ s/\r|\n|\t| $//gi; + $row[5] =~ s/\r|\n|\t| $//gi; + $row[4] =~ s/\r|\n|\t| $//gi; + $row[3] =~ s/\r|\n|\t| $//gi; + $row[2] =~ s/\r|\n|\t| $//gi; + $row[1] =~ s/\r|\n|\t| $//gi; + $row[0] =~ s/\r|\n|\t| $//gi; + $pc++; + $ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$row[6]', '$row[7]'), "; + if ($pc =~ /00$/) { + chop($ins_stmt); + chop($ins_stmt); + $dbh->query($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n"; + $ins_stmt="insert into vicidial_phone_codes VALUES "; + print STDERR "$pc\n"; + } + } + + chop($ins_stmt); + chop($ins_stmt); + $dbh->query($ins_stmt); + $ins_stmt="insert into vicidial_phone_codes VALUES "; + print STDERR "$pc\n"; + +exit; \ No newline at end of file diff --git a/ADMIN_keepalive_AST_VDautodial.pl b/ADMIN_keepalive_AST_VDautodial.pl new file mode 100644 index 0000000..b40027f --- /dev/null +++ b/ADMIN_keepalive_AST_VDautodial.pl @@ -0,0 +1,120 @@ +#!/usr/bin/perl +# +# ADMIN_keepalive_AST_VDauto_dial.pl version 0.3 +# +# designed to keep the AST_update processes aline and check every minute +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 50810-1452 - removed '-L' flag for screen logging of output (optimization) +# 50823-1454 - Added commandline debug options with debug printouts +# + +$DB=0; # Debug flag +$MT[0]=''; $MT[1]=''; +@psline=@MT; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$running_VDAD = 0; + +$i=0; +foreach (@psoutput) +{ + chomp($psoutput[$i]); +if ($DBX) {print "$i|$psoutput[$i]| \n";} +@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + +if ($psline[1] =~ /\/home\/cron\/AST_VDauto_dial\.pl/) + { + $running_VDAD++; + if ($DB) {print "VDAD RUNNING: |$psline[1]|\n";} + } + +$i++; +} + + +if (!$running_VDAD) +{ +# print "double check that VDAD is not running\n"; + + sleep(4); + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; +$i=0; +foreach (@psoutput2) + { + chomp($psoutput2[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); + + if ($psline[1] =~ /\/home\/cron\/AST_VDauto_dial\.pl/) + { + $running_VDAD++; + if ($DB) {print "VDAD RUNNING: |$psline[1]|\n";} + } + + $i++; + } + +if (!$running_VDAD) + { + if ($DB) {print "starting AST_VDauto_dial...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDauto /home/cron/AST_VDauto_dial.pl`; + } +} + + + + + if ($DB) {print "DONE\n";} + +exit; diff --git a/ADMIN_keepalive_AST_VDremote_agents.pl b/ADMIN_keepalive_AST_VDremote_agents.pl new file mode 100644 index 0000000..5b83422 --- /dev/null +++ b/ADMIN_keepalive_AST_VDremote_agents.pl @@ -0,0 +1,119 @@ +#!/usr/bin/perl +# +# ADMIN_keepalive_AST_VDremote_agents.pl version 0.3 +# +# designed to keep the AST_update processes aline and check every minute +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 50810-1453 - removed '-L' flag for screen logging of output (optimization) +# 50823-1459 - Added commandline debug options with debug printouts +# + +$DB=0; # Debug flag +$MT[0]=''; $MT[1]=''; +@psline=@MT; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$running_VDra = 0; + +$i=0; +foreach (@psoutput) +{ + chomp($psoutput[$i]); +if ($DBX) {print "$i|$psoutput[$i]| \n";} +@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + +if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) + { + $running_VDra++; + if ($DB) {print "VDra RUNNING: |$psline[1]|\n";} + } + +$i++; +} + + +if (!$running_VDra) +{ +# print "double check that update is not running\n"; + + sleep(5); + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; +$i=0; +foreach (@psoutput2) + { + chomp($psoutput2[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); + + if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) + { + $running_VDra++; + if ($DB) {print "VDra RUNNING: |$psline[1]|\n";} + } + + $i++; + } + +if (!$running_VDra) + { + if ($DB) {print "starting AST_VDremote_agents...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDremote /home/cron/AST_VDremote_agents.pl`; + } +} + + + + + if ($DB) {print "DONE\n";} + +exit; diff --git a/ADMIN_keepalive_AST_send_listen.pl b/ADMIN_keepalive_AST_send_listen.pl new file mode 100644 index 0000000..bdf94ea --- /dev/null +++ b/ADMIN_keepalive_AST_send_listen.pl @@ -0,0 +1,169 @@ +#!/usr/bin/perl +# +# ADMIN_keepalive_AST_send_listen.pl version 0.3 +# +# designed to keep the AST_manager_listen and manager_send processes alive and check every minute +# +# if you are on an older system you may need to change the @psoutput lines to fit your ps version +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 50810-1450 - removed '-L' flag for screen logging of output (optimization) +# 50823-1440 - Added commandline debug options with debug printouts +# + +$DB=0; # Debug flag +$MT[0]=''; $MT[1]=''; +@psline=@MT; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + sleep(1); + + +#@psoutput = `ps -f -C AST_manager --no-headers`; +#@psoutput = `ps -f --no-headers -C AST_manager_s*; ps -f --no-headers -C AST_manager_l*`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$running_listen = 0; +$running_send = 0; + +$i=0; +foreach (@psoutput) +{ + chomp($psoutput[$i]); +if ($DBX) {print "$i|$psoutput[$i]| \n";} +@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + +if ($psline[1] =~ /AST_manager_li/) + { + $running_listen++; + if ($DB) {print "LISTEN RUNNING: |$psline[1]|\n";} + } +if ($psline[1] =~ /AST_manager_se/) + { + $running_send++; + if ($DB) {print "SEND RUNNING: |$psline[1]|\n";} + } + +$i++; +} + + + +if (!$running_listen) +{ + # print "double check that update_11 is not running\n"; + + sleep(1); + +#@psoutput = `ps -f -C AST_manager --no-headers`; +#@psoutput = `ps -f --no-headers -C AST_manager_s*; ps -f --no-headers -C AST_manager_l*`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$i=0; +foreach (@psoutput2) + { + chomp($psoutput2[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); + + if ($psline[1] =~ /AST_manager_li/) + { + $running_listen++; + if ($DB) {print "LISTEN RUNNING: |$psline[1]|\n";} + } + + $i++; + } + +if (!$running_listen) + { + if ($DB) {print "starting AST_manager_listen...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTlisten /home/cron/AST_manager_listen.pl`; + } +} + + + + +if (!$running_send) +{ + # print "double check that update_12 is not running\n"; + + sleep(1); + +#@psoutput = `ps -f -C AST_manager --no-headers`; +#@psoutput = `ps -f --no-headers -C AST_manager_s*; ps -f --no-headers -C AST_manager_l*`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; +$i=0; +foreach (@psoutput) + { + chomp($psoutput[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_se/) + { + $running_send++; + if ($DB) {print "SEND RUNNING: |$psline[1]|";} + } + + $i++; + } + +if (!$running_send) + { + if ($DB) {print "starting AST_manager_send...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTsend /home/cron/AST_manager_send.pl`; + } +} + + + + + if ($DB) {print "DONE\n";} + +exit; diff --git a/ADMIN_keepalive_AST_update.pl b/ADMIN_keepalive_AST_update.pl new file mode 100644 index 0000000..4a713e3 --- /dev/null +++ b/ADMIN_keepalive_AST_update.pl @@ -0,0 +1,121 @@ +#!/usr/bin/perl +# +# ADMIN_keepalive_AST_update.pl version 0.4 +# +# designed to keep the AST_update processes aline and check every minute +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 50810-1451 - removed '-L' flag for screen logging of output (optimization) +# 50823-1446 - Added commandline debug options with debug printouts +# 51229-1027 - fixed typo of array name +# + +$DB=0; # Debug flag +$MT[0]=''; $MT[1]=''; +@psline=@MT; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$running_update = 0; + +$i=0; +foreach (@psoutput) +{ + chomp($psoutput[$i]); +if ($DBX) {print "$i|$psoutput[$i]| \n";} +@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + +if ($psline[1] =~ /\/home\/cron\/AST_update\.pl/) + { + $running_update++; + if ($DB) {print "UPDATE RUNNING: |$psline[1]|\n";} + } + +$i++; +} + + +if (!$running_update) +{ +# print "double check that update is not running\n"; + + sleep(5); + +#@psoutput = `ps -f -C AST_update --no-headers`; +#@psoutput = `ps -f -C AST_updat* --no-headers`; +#@psoutput = `/bin/ps -f --no-headers -A`; +@psoutput2 = `/bin/ps -o "%p %a" --no-headers -A`; +$i=0; +foreach (@psoutput2) + { + chomp($psoutput2[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); + + if ($psline[1] =~ /\/home\/cron\/AST_update\.pl/) + { + $running_update++; + if ($DB) {print "UPDATE RUNNING: |$psline[1]|\n";} + } + + $i++; + } + +if (!$running_update) + { + if ($DB) {print "starting AST_update...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTupdate /home/cron/AST_update.pl`; + } +} + + + + + if ($DB) {print "DONE\n";} + +exit; diff --git a/ADMIN_keepalive_send_listen.at b/ADMIN_keepalive_send_listen.at new file mode 100644 index 0000000..652c1bc --- /dev/null +++ b/ADMIN_keepalive_send_listen.at @@ -0,0 +1,6 @@ +#!/bin/sh + +/home/cron/ADMIN_keepalive_AST_send_listen.pl + +exit + diff --git a/ADMIN_restart_roll_logs.pl b/ADMIN_restart_roll_logs.pl new file mode 100644 index 0000000..a617e3d --- /dev/null +++ b/ADMIN_restart_roll_logs.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl +# ADMIN_restart_roll_logs.pl - script to roll the Asterisk logs on machine restart +# have this run on the astersik server +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday---$hour$min$sec"; + + +print "rolling AST_update log...\n"; +`mv -f /home/cron/LOG_AST_update.log /home/cron/LOGS/LOG_AST_update.log.$now_date`; + +print "rolling MSAST_update log...\n"; +`mv -f /home/cron/MSLOG_AST_update.log /home/cron/LOGS/MSLOG_AST_update.log.$now_date`; + +print "rolling LIAST_update log...\n"; +`mv -f /home/cron/LILOG_AST_update.log /home/cron/LOGS/LILOG_AST_update.log.$now_date`; + +print "rolling VDAST_update log...\n"; +`mv -f /home/cron/VDLOG_AST_update.log /home/cron/LOGS/VDLOG_AST_update.log.$now_date`; + +print "rolling Asterisk messages log...\n"; +`mv -f /var/log/asterisk/messages /var/log/asterisk/messages.$now_date`; + +print "rolling Asterisk event log...\n"; +`mv -f /var/log/asterisk/event_log /var/log/asterisk/event_log.$now_date`; + +print "rolling Asterisk cdr logs...\n"; +`mv -f /var/log/asterisk/cdr-csv/Master.csv /var/log/asterisk/cdr-csv/Master.csv.$now_date`; +`mv -f /var/log/asterisk/cdr-custom/Master.csv /var/log/asterisk/cdr-custom/Master.csv.$now_date`; + +print "rolling Asterisk screen log...\n"; +`mv -f /screenlog.0 /screenlog.0.$now_date`; + +print "rolling Asterisk root screen log...\n"; +`mv -f /root/screenlog.0 /root/screenlog.0.$now_date`; + + +print "FINISHED... EXITING\n"; + +exit; diff --git a/AST_CRON_mix_recordings.pl b/AST_CRON_mix_recordings.pl new file mode 100644 index 0000000..1c7557b --- /dev/null +++ b/AST_CRON_mix_recordings.pl @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 Added quotes around CLI executed commands +# 51122-1458 Added soxmix binary path check +# + + +#$v=1; + +# Customize variables for FTP +$FTP_host = '10.0.0.4'; +$FTP_user = 'cron'; +$FTP_pass = 'test'; +$FTP_dir = 'RECORDINGS'; + +### directory where in/out recordings are saved to by Asterisk +$dir1 = '/var/spool/asterisk/monitor'; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir1/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir1/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir1/ORIG/$OUTfile"`; + `mv -f "$dir1/$ALLfile" "$dir1/DONE/$ALLfile"`; + } + + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$FTP_host"); + + if ($ping_good) + { + $ftp = Net::FTP->new("$FTP_host", Port => 21); + $ftp->login("$FTP_user","$FTP_pass"); + $ftp->cwd("$FTP_dir"); + $ftp->binary(); + $ftp->put("$dir1/DONE/$ALLfile", "$ALLfile"); + $ftp->quit; + } + ### END Remote file transfer + + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/AST_CRON_mix_recordings_BASIC.pl b/AST_CRON_mix_recordings_BASIC.pl new file mode 100644 index 0000000..4786e67 --- /dev/null +++ b/AST_CRON_mix_recordings_BASIC.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_BASIC.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 Added quotes around CLI executed commands +# 51122-1456 Added soxmix binary path check +# + + +#$v=1; + + +### directory where in/out recordings are saved to by Asterisk +$dir1 = '/var/spool/asterisk/monitor'; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir1/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir1/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir1/ORIG/$OUTfile"`; + `mv -f "$dir1/$ALLfile" "$dir1/DONE/$ALLfile"`; + } + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/AST_CRON_mix_recordings_GSM.pl b/AST_CRON_mix_recordings_GSM.pl new file mode 100644 index 0000000..02c5ef6 --- /dev/null +++ b/AST_CRON_mix_recordings_GSM.pl @@ -0,0 +1,151 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_GSM.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# and converts the ALL file to GSM format to save space. +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 Added quotes around CLI executed commands +# 51122-1455 Added soxmix and sox binary path check +# + + +#$v=1; + +# Customize variables for FTP +$FTP_host = '10.0.0.4'; +$FTP_user = 'cron'; +$FTP_pass = 'test'; +$FTP_dir = 'RECORDINGS'; +$FTP_port = '21'; + +### directory where in/out recordings are saved to by Asterisk +$dir1 = '/var/spool/asterisk/monitor'; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } +$soxbin = ''; +if ( -e ('/usr/bin/sox')) {$soxbin = '/usr/bin/sox';} +else + { + if ( -e ('/usr/local/bin/sox')) {$soxbin = '/usr/local/bin/sox';} + else + { + print "Can't find sox binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $GSMfile = $ALLfile; + $GSMfile =~ s/-all\.wav/-all.gsm/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir1/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir1/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir1/ORIG/$OUTfile"`; + `mv -f "$dir1/$ALLfile" "$dir1/DONE/$ALLfile"`; + } + else + { + `cp -f "$dir1/$ALLfile" "$dir1/DONE/$ALLfile"`; + } + + `$soxbin "$dir1/DONE/$ALLfile" "$dir1/DONE/$GSMfile"`; + + if (!$T) + { + `rm -f "$dir1/DONE/$ALLfile"`; + } + + if($DB){print STDERR "\n|/usr/bin/sox $live_folder/$filename[$k]$WAV $arch_folder/$filename[$k]$GSM|\n";} + chmod 0755, "$dir1/DONE/$GSMfile"; + + ### BEGIN Remote file transfer + # $p = Net::Ping->new(); + # $ping_good = $p->ping("$FTP_host"); + + # if ($ping_good) + # { + $ftp = Net::FTP->new("$FTP_host", Port => $FTP_port, Debug => 0, Passive => 1); + $ftp->login("$FTP_user","$FTP_pass"); + $ftp->cwd("$FTP_dir"); + $ftp->binary(); + $ftp->put("$dir1/DONE/$GSMfile", "$GSMfile"); + $ftp->quit; + # } + ### END Remote file transfer + + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/AST_DB_optimize.pl b/AST_DB_optimize.pl new file mode 100644 index 0000000..2c1aabf --- /dev/null +++ b/AST_DB_optimize.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl +# +# AST_DB_optimize.pl version 0.1 +# +# DESCRIPTION: +# optimizes the tables used in the asterisk MySQL database +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + + + $stmtA = "optimize table call_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table park_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_closer_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_xfer_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_list;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_manager;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_auto_calls;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + $stmtA = "optimize table vicidial_live_agents;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + { + if ($DB) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + + + $dbhA->close; + + +exit; + + + + + + diff --git a/AST_SERVER_conf.pl b/AST_SERVER_conf.pl new file mode 100644 index 0000000..ba87cee --- /dev/null +++ b/AST_SERVER_conf.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +# AST_SERVER_conf.pl +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +# Customized Variables +$server_ip = '10.10.10.15'; # Asterisk server IP +$DB_server = 'localhost'; # MySQL server IP +$DB_database = 'asterisk'; # MySQL database name +$DB_user = 'cron'; # MySQL user +$DB_pass = '1234'; # MySQL pass +$DB_port = '3306'; # MySQL connection port + +$LOGfile = '/home/cron/LOG_AST_update.log'; +$telnetlog = '/home/cron/telnetlog.log'; +$MSLOGfile = '/home/cron/MSLOG_AST_update.log'; +$MStelnetlog = '/home/cron/MStelnetlog.log'; +$LILOGfile = '/home/cron/LILOG_AST_update.log'; +$LItelnetlog = '/home/cron/LItelnetlog.log'; +$KHLOGfile = '/home/cron/KHLOG_AST_update.log'; +$VDADLOGfile = '/home/cron/VDLOG_AST_update.log'; + +return 1; diff --git a/AST_VDauto_dial.pl b/AST_VDauto_dial.pl new file mode 100644 index 0000000..1352416 --- /dev/null +++ b/AST_VDauto_dial.pl @@ -0,0 +1,939 @@ +#!/usr/bin/perl +# +# AST_VDauto_dial.pl version 0.9 +# +# DESCRIPTION: +# uses Net::MySQL to place auto_dial calls on the VICIDIAL dialer system +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL, this program must be in the cron constantly +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# This script is to run perpetually querying every second to place new phone +# calls from the vicidial_hopper based upon how many available agents there are +# and the value of the auto_dial_level setting in the campaign screen of the +# admin web page +# +# 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) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds +# 50317-0954 - Added duplicate check per cycle to account for DB lockups +# 50322-1302 - Added campaign custom callerid feature +# 50324-1353 - Added optional variable to record ring time thru separate diap prefix +# 50606-2308 - Added code to ensure no calls placed out on inactive campaign +# 50617-1248 - Added code to place LOGOUT entry in auto-paused user logs +# 50620-1349 - Added custom vdad transfer AGI extension per campaign +# 50810-1610 - Added database server variable definitions lookup +# 50810-1630 - Added max_vicidial_trunks server limiter on active lines +# 50812-0957 - corrected max_trunks logic, added update of server every 25 sec +# 60120-1522 - corrected time error for hour variable, caused agi problems +# + + +### 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 [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n"; + } + else + { + if ($args =~ /--delay=/i) + { + @data_in = split(/--delay=/,$args); + $loop_delay = $data_in[1]; + print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n"; + $loop_delay = ($loop_delay * 1000); + } + else + { + $loop_delay = '2500'; + } + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2500'; + $DB=1; +} +### end parsing run-time options ### + + +# constants +$US='__'; +$MT[0]=''; +$RECcount=''; ### leave blank for no REC count +$RECprefix='7'; ### leave blank for no REC prefix + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + + &get_time_now; # update time/date variables + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; # writes to the log and if debug flag is set prints to STDOUT + +use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; + + ### connect to MySQL database defined in the AST_SERVER_conf.pl file + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 12; # 1 month loops for one year +while($one_day_interval > 0) +{ + + $endless_loop=5760000; # 30 days minutes at XXX seconds per loop + + while($endless_loop > 0) + { + &get_time_now; + + ############################################################################### + ###### first figure out how many calls should be placed for each campaign per server + ############################################################################### + @DBlive_user=@MT; + @DBlive_server_ip=@MT; + @DBlive_campaign=@MT; + @DBlive_conf_exten=@MT; + @DBcampaigns=@MT; + @DBIPaddress=@MT; + @DBIPcampaign=@MT; + @DBIPactive=@MT; + @DBIPvdadexten=@MT; + @DBIPcount=@MT; + @DBIPadlevel=@MT; + @DBIPdialtimeout=@MT; + @DBIPdialprefix=@MT; + @DBIPcampaigncid=@MT; + @DBIPexistcalls=@MT; + @DBIPgoalcalls=@MT; + @DBIPmakecalls=@MT; + + $active_line_counter=0; + $user_counter=0; + $user_campaigns = '|'; + $user_campaigns_counter = 0; + $user_campaignIP = '|'; + $user_CIPct = 0; + + ##### Get a listing of the users that are active and ready to take calls + ##### Also get a listing of the campaigns and campaigns/serverIP that will be used + $dbhA->query("SELECT user,server_ip,campaign_id,conf_exten FROM vicidial_live_agents where status IN('READY','QUEUE','INCALL','DONE') and server_ip='$server_ip' and last_update_time > '$BDtsSQLdate' order by last_call_time"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBlive_user[$user_counter] = "$record->[0]"; + $DBlive_server_ip[$user_counter] = "$record->[1]"; + $DBlive_campaign[$user_counter] = "$record->[2]"; + $DBlive_conf_exten[$user_counter] = "$record->[3]"; + + if ($user_campaigns !~ /\|$DBlive_campaign[$user_counter]\|/i) + { + $user_campaigns .= "$DBlive_campaign[$user_counter]|"; + $DBcampaigns[$user_campaigns_counter] = $DBlive_campaign[$user_counter]; + $user_campaigns_counter++; + } + if ($user_campaignIP !~ /\|$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]\|/i) + { + $user_campaignIP .= "$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]|"; + $DBIPcampaign[$user_CIPct] = "$DBlive_campaign[$user_counter]"; + $DBIPaddress[$user_CIPct] = "$DBlive_server_ip[$user_counter]"; + $user_CIPct++; + } + $user_counter++; + } + } + + $event_string="LIVE AGENTS LOGGED IN: $user_counter"; + &event_logger; + + $user_CIPct = 0; + foreach(@DBIPcampaign) + { + $user_counter=0; + foreach(@DBlive_campaign) + { + if ( ($DBlive_campaign[$user_counter] =~ /$DBIPcampaign[$user_CIPct]/i) && ($DBlive_server_ip[$user_counter] =~ /$DBIPaddress[$user_CIPct]/i) ) + { + $DBIPcount[$user_CIPct]++ + } + $user_counter++; + } + + ### grab the dial_level and multiply by active agents to get your goalcalls + $DBIPadlevel[$user_CIPct]=0; + $dbhA->query("SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBIPadlevel[$user_CIPct] = "$record->[0]"; + $DBIPcalltime[$user_CIPct] = "$record->[1]"; + $DBIPdialtimeout[$user_CIPct] = "$record->[2]"; + $DBIPdialprefix[$user_CIPct] = "$record->[3]"; + $DBIPcampaigncid[$user_CIPct] = "$record->[4]"; + $DBIPactive[$user_CIPct] = "$record->[5]"; + $DBIPvdadexten[$user_CIPct] = "$record->[6]"; + } + } + + $DBIPgoalcalls[$user_CIPct] = ($DBIPadlevel[$user_CIPct] * $DBIPcount[$user_CIPct]); + if ($DBIPactive[$user_CIPct] =~ /N/) {$DBIPgoalcalls[$user_CIPct] = 0;} + $DBIPgoalcalls[$user_CIPct] = sprintf("%.0f", $DBIPgoalcalls[$user_CIPct]); + + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] dial_level: $DBIPadlevel[$user_CIPct]"; + &event_logger; + + $active_line_counter=0; + $active_line_goal=0; + ### see how many total VDAD calls are going on right now for max limiter + $dbhA->query("SELECT count(*) FROM vicidial_auto_calls where server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER');"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $active_line_counter = "$record->[0]"; + } + } + + ### see how many calls are alrady active per campaign per server and + ### subtract that number from goalcalls to determine how many new + ### calls need to be placed in this loop + if ($DBIPcampaign[$user_CIPct] =~ /CLOSER/) + {$campaign_query = "campaign_id LIKE \"CL%\"";} + else {$campaign_query = "campaign_id='$DBIPcampaign[$user_CIPct]'";} + $dbhA->query("SELECT count(*) FROM vicidial_auto_calls where $campaign_query and server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBIPexistcalls[$user_CIPct] = "$record->[0]"; + } + } + + $DBIPmakecalls[$user_CIPct] = ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]); + $MVT_msg = ''; + $active_line_goal = ($active_line_counter + $DBIPmakecalls[$user_CIPct]); + if ($active_line_goal > $max_vicidial_trunks) + { + $MVT_msg = "MVT override: $max_vicidial_trunks"; + $DBIPmakecalls[$user_CIPct] = ($max_vicidial_trunks - $active_line_counter); + } + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]) $MVT_msg"; + &event_logger; + + $user_CIPct++; + } + + ############################################################################### + ###### second lookup leads and place calls for each campaign/server_ip + ###### go one lead at a time and place the call by inserting a record into vicidial_manager + ############################################################################### + + $user_CIPct = 0; + foreach(@DBIPcampaign) + { + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($DBIPcalltime[$user_CIPct] =~ /24hours/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|"; + $p = ($p - 0.25); + } + } + if ($DBIPcalltime[$user_CIPct] =~ /9am-9pm/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 9) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|";} + $p = ($p - 0.25); + } + } + if ($DBIPcalltime[$user_CIPct] =~ /9am-5pm/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 9) && ($hour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|";} + $p = ($p - 0.25); + } + } + if ($DBIPcalltime[$user_CIPct] =~ /12pm-5pm/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 12) && ($hour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|";} + $p = ($p - 0.25); + } + } + if ($DBIPcalltime[$user_CIPct] =~ /12pm-9pm/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 12) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|";} + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /5pm-9pm/) + { + $p='13'; + $GMT_allowed = '|'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 17) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "$tz|";} + $p = ($p - 0.25); + } + } + + + + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: CALLING"; + &event_logger; + $call_CMPIPct=0; + $lead_id_call_list='|'; + my $UDaffected_rows=0; + if ($call_CMPIPct < $DBIPmakecalls[$user_CIPct]) + { + $stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by hopper_id LIMIT $DBIPmakecalls[$user_CIPct]"; + print "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $UDaffected_rows = $dbhA->get_affected_rows_length; + print "hopper rows updated to QUEUE: |$UDaffected_rows|\n"; + + if ($UDaffected_rows) + { + $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; + while ($call_CMPIPct < $UDaffected_rows) + { + $stmtA = "SELECT lead_id FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' LIMIT 1"; + print "|$stmtA|\n"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $lead_id = "$record->[0]"; + } + } + + if ($lead_id_call_list =~ /\|$lead_id\|/) + { + print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n"; + open(DUPout, ">>/home/cron/VDAD_DUPLICATE.$file_date") + || die "Can't open /home/cron/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"; + $dbhA->query("$stmtA"); + my $UQaffected_rows = $dbhA->get_affected_rows_length; + print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n"; + + $stmtA = "SELECT * FROM vicidial_list where lead_id='$lead_id';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $gmt_offset_now = "$record->[8]"; + $phone_code = "$record->[10]"; + $phone_number = "$record->[11]"; + $called_count = "$record->[30]"; + + $rec_countCUSTDATA++; + } + } + if ( ($rec_countCUSTDATA) && ($GMT_allowed !~ /\|$gmt_offset_now\|/) ) + { + $rec_countCUSTDATA=0; + $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + # $GMT_allowed + $event_string = "| out of call time range lead DELETED $affected_rows|$lead_id|$phone_number|$gmt_offset_now|"; + &event_logger; + } + + if ($rec_countCUSTDATA) + { + ### update called_count + $called_count++; + + $stmtA = "UPDATE vicidial_list set called_since_last_reset='Y', called_count='$called_count',user='VDAD' where lead_id='$lead_id'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";} + if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";} + else {$VDAD_dial_exten = "$answer_transfer_agent";} + + if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;} + if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';} + + if ($RECcount) + { + if ( (length($RECprefix)>0) && ($called_count < $RECcount) ) + {$Local_out_prefix .= "$RECprefix";} + } + $PADlead_id = sprintf("%09s", $lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + + $lead_id_call_list .= "$lead_id|"; + + ### 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";} + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DBIPaddress[$user_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','')"; + $dbhA->query($stmtA); + + # $GMT_allowed + $event_string = "| number call dialed|$DBIPcampaign[$user_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|"; + &event_logger; + + ### insert a SENT record to the vicidial_auto_calls table + $stmtA = "INSERT INTO vicidial_auto_calls values('','$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','','$VqueryCID','','$phone_code','$phone_number','$SQLdate')"; + $dbhA->query($stmtA); + + ### sleep for a tenth of a second to not flood the server with new calls + usleep(1*100*1000); + + } + } + $call_CMPIPct++; + } + } + + } + + $user_CIPct++; + } + + + + + + + + &get_time_now; + + ############################################################################### + ###### third we will grab the callerids of the vicidial_auto_calls records and check for dead calls + ###### we also check to make sure that it isn't a call that has been transferred, + ###### if it has been we need to leave the vicidial_list status alone + ############################################################################### + + @KLcallerid = @MT; + @KLserver_ip = @MT; + @KLchannel = @MT; + $kill_vac=0; + + $stmtA = "SELECT callerid,server_ip,channel,uniqueid FROM vicidial_auto_calls where server_ip='$server_ip' order by call_time;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $KLcallerid[$kill_vac] = "$record->[0]"; + $KLserver_ip[$kill_vac] = "$record->[1]"; + $KLchannel[$kill_vac] = "$record->[2]"; + $KLuniqueid[$kill_vac] = "$record->[3]"; + + $kill_vac++; + } + } + + $kill_vac=0; + foreach(@KLcallerid) + { + if (length($KLserver_ip[$kill_vac]) > 7) + { + $end_epoch=0; $CLuniqueid=''; + + $stmtA = "SELECT end_epoch,uniqueid FROM call_log where caller_code='$KLcallerid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $end_epoch = "$record->[0]"; + $CLuniqueid = "$record->[1]"; + } + } + + if ( (length($KLuniqueid[$kill_vac]) > 15) && (length($CLuniqueid) < 15) ) + { + $stmtA = "SELECT end_epoch,uniqueid FROM call_log where uniqueid='$KLuniqueid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $end_epoch = "$record->[0]"; + $CLuniqueid = "$record->[1]"; + } + } + } + if ($end_epoch > 1000) + { + $CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code=''; + + $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $auto_call_id = "$record->[0]"; + $CLlead_id = "$record->[1]"; + $CLphone_number = "$record->[2]"; + $CLstatus = "$record->[3]"; + $CLcampaign_id = "$record->[4]"; + $CLphone_code = "$record->[5]"; + } + } + $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'"; + # $stmtA = "UPDATE vicidial_auto_calls set status='PAUSED' where callerid='$KLcallerid[$kill_vac]'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| dead call vac deleted|$auto_call_id|$CLlead_id|$KLcallerid[$kill_vac]|$end_epoch|$affected_rows|$KLchannel[$kill_vac]|"; + &event_logger; + + if ($CLstatus !~ /XFER|CLOSER/) + { + if ($CLstatus =~ /LIVE/) {$CLnew_status = 'DROP';} + else + { + $CLnew_status = 'NA'; + $end_epoch = ($now_date_epoch + 1); + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','NA','$CLphone_code','$CLphone_number','VDAD','N','1','$end_epoch')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + $event_string = "| dead NA call added to log $CLuniqueid|$CLlead_id|$CLphone_number|$CLstatus|$CLnew_status|"; + &event_logger; + + } + + $stmtA = "UPDATE vicidial_list set status='$CLnew_status' where lead_id='$CLlead_id'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| dead call vac lead marked $CLnew_status|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + + $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + } + else + { + $event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + } + } + } + $kill_vac++; + } + + + + ### pause agents that have disconnected or closed their apps over 30 seconds ago + $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED')"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| lagged call vla agent PAUSED $affected_rows|$PDtsSQLdate|$BDtsSQLdate|$tsSQLdate|"; + &event_logger; + + if ($affected_rows > 0) + { + @VALOuser=@MT; @VALOcampaign=@MT; @VALOtimelog=@MT; @VALOextension=@MT; + $logcount=0; + $stmtA = "SELECT user,campaign_id,last_update_time,extension FROM vicidial_live_agents where server_ip='$server_ip' and status = 'PAUSED' and random_id='10' order by last_update_time desc limit $affected_rows"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VALOuser[$logcount] = "$record->[0]"; + $VALOcampaign[$logcount] = "$record->[1]"; + $VALOtimelog[$logcount] = "$record->[2]"; + $VALOextension[$logcount] = "$record->[3]"; + $logcount++; + } + } + $logrun=0; + foreach(@VALOuser) + { + $stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch');"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| lagged agent LOGOUT entry inserted $VALOuser[$logrun]|$VALOcampaign[$logrun]|$VALOextension[$logcount]|"; + &event_logger; + + $logrun++; + } + + } + + + ### delete call records that are SENT for over 3 minutes + $stmtA = "DELETE FROM vicidial_auto_calls where server_ip='$server_ip' and call_time < '$XDSQLdate' and status NOT IN('XFER','CLOSER','LIVE')"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| lagged call vac agent DELETED $affected_rows|$XDSQLdate|"; + &event_logger; + + + + + + ############################################################################### + ###### last, wait for a little bit and repeat the loop + ############################################################################### + + ### sleep for 2 and a half seconds before beginning the loop again + usleep(1*$loop_delay*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program + if (-e '/home/cron/VDAD.kill') + { + unlink('/home/cron/VDAD.kill'); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + if ($endless_loop =~ /0$/) # run every ten cycles (about 25 seconds) + { + ### delete call records that are LIVE for over 10 minutes + $stmtA = "DELETE FROM vicidial_auto_calls where server_ip='$server_ip' and call_time < '$TDSQLdate' and status NOT IN('XFER','CLOSER')"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| lagged call vac agent DELETED $affected_rows|$TDSQLdate|LIVE|"; + &event_logger; + + ### Grab Server values from the database in case they've changed + $stmtA = "SELECT max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBmax_vicidial_trunks = "$record->[0]"; + $DBanswer_transfer_agent= "$record->[1]"; + $DBSERVER_GMT = "$record->[2]"; + $DBext_context = "$record->[3]"; + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + + $event_string = "| updating server parameters $max_vicidial_trunks|$answer_transfer_agent|$SERVER_GMT|$ext_context|"; + &event_logger; + + &get_time_now; + + #@psoutput = `/bin/ps -f --no-headers -A`; + @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + + $running_listen = 0; + + $i=0; + foreach (@psoutput) + { + chomp($psoutput[$i]); + + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_li/) {$running_listen++;} + + $i++; + } + + if (!$running_listen) + { + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED NO LISTENER RUNNING... EXITING\n\n"; + } + + if($DB){print "checking to see if listener is dead |$running_listen|\n";} + } + + $bad_grabber_counter=0; + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->close; + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ + $secX = time(); +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$file_date = "$year-$mon-$mday"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +$BDtarget = ($secX - 10); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +$PDtarget = ($secX - 30); +($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget); +$Pyear = ($Pyear + 1900); +$Pmon++; +if ($Pmon < 10) {$Pmon = "0$Pmon";} +if ($Pmday < 10) {$Pmday = "0$Pmday";} +if ($Phour < 10) {$Phour = "0$Phour";} +if ($Pmin < 10) {$Pmin = "0$Pmin";} +if ($Psec < 10) {$Psec = "0$Psec";} + $PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec"; + +$XDtarget = ($secX - 120); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 600); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +} + + + + + +sub event_logger +{ + +if ($DB) {print "$now_date|$event_string|\n";} + ### open the log file for writing ### + open(Lout, ">>$VDADLOGfile") + || die "Can't open $VDADLOGfile: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} diff --git a/AST_VDhopper.pl b/AST_VDhopper.pl new file mode 100644 index 0000000..baa5b92 --- /dev/null +++ b/AST_VDhopper.pl @@ -0,0 +1,570 @@ +#!/usr/bin/perl +# +# AST_VDhopper.pl version 0.4 +# +# DESCRIPTION: +# uses Net::MySQL to update the VICIDIAL leads hopper for the new streamlined +# approach of allocating leads to client machines. +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL, this program must be in the cron running +# every minute +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute and you are getting close to no leads after +# a minute, you may want to play with the variables below to streamline for +# your usage +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50810-1613 - Added database server variable definitions lookup +# 60215-1106 - Added Scheduled Callback release functionality +# 60228-1623 - Change Callback activation to set the called_since_last_reset=N +# 60228-1735 - Added hopper gmt validation to remove gmt outside of time range +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate lots of lines of output per minute +$US='__'; +$MT[0]=''; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +if (!$VDHLOGfile) {$VDHLOGfile = "/home/cron/hopper.$year-$mon-$mday";} + +### 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(must stay in this order):\n [--debug] = debug\n [--dbgmt] = show GMT offset of records as they are inserted into hopper\n [-t] = test\n [--level=XXX] = force a hopper_level of XXX\n [--campaign=XXX] = run for campaign XXX only\n\n"; + } + else + { + if ($args =~ /--campaign=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--campaign=/,$args); + $CLIcampaign = $data_in[1]; + } + else + {$CLIcampaign = '';} + if ($args =~ /--level=/i) + { + @data_in = split(/--level=/,$args); + $CLIlevel = $data_in[1]; + $CLIlevel =~ s/ .*$//gi; + $CLIlevel =~ s/\D//gi; + print "\n-----HOPPER LEVEL OVERRIDE: $CLIlevel -----\n\n"; + } + else + {$CLIlevel = '';} + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUG -----\n\n"; + } + if ($args =~ /--dbgmt/i) + { + $DB_show_offset=1; + print "\n-----DEBUG GMT -----\n\n"; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + if ($args =~ /--wipe-hopper-clean/i) + { + $wipe_hopper_clean=1; + } + } +} +else +{ +print "no command line options set\n"; +} + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +sleep(1); ### sleep for 5 seconds to stagger cron script load + +use lib './lib', '../lib'; +use Net::MySQL; + + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBSERVER_GMT = "$record->[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + } + } + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +if ($wipe_hopper_clean) + { + $stmtA = "DELETE from vicidial_hopper;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print "Hopper Wiped Clean: $affected_rows\n";} + $event_string = "|HOPPER WIPE CLEAN|"; + &event_logger; + + exit; + } + + + +### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed +$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE' and recipient='ANYONE';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $CBHOLD_count = "$record->[0]"; + } + } + + if ($DB) {print "CALLBACK HOLD: $CBHOLD_count|$stmtA|\n";} + +if ($CBHOLD_count > 0) + { + $update_leads=''; + $stmtA = "SELECT lead_id FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE' and recipient='ANYONE';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $cbc=0; + while ( $record = $iter->each) + { + $lead_ids[$cbc] = $record->[0]; + $update_leads .= "'$lead_ids[$cbc]',"; + $cbc++; + } + } + if ($cbc > 0) + { + chop($update_leads); + + $stmtA = "UPDATE vicidial_list set status='CALLBK', called_since_last_reset='N' where lead_id IN($update_leads);"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS LISTACT|$affected_rows|"; + &event_logger; + + $stmtA = "UPDATE vicidial_callbacks set status='LIVE' where lead_id IN($update_leads);"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS CB ACT |$affected_rows|"; + &event_logger; + + } + } +### END Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed + + + +@campaign_id=@MT; + +if ($CLIcampaign) + { + $stmtA = "SELECT * from vicidial_campaigns where campaign_id='$CLIcampaign'"; + } +else + { + $stmtA = "SELECT * from vicidial_campaigns where active='Y'"; + } + +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + $campaign_id[$rec_count] = "$record->[0]"; + $dial_status_a[$rec_count] = "$record->[3]"; + $dial_status_b[$rec_count] = "$record->[4]"; + $dial_status_c[$rec_count] = "$record->[5]"; + $dial_status_d[$rec_count] = "$record->[6]"; + $dial_status_e[$rec_count] = "$record->[7]"; + $lead_order[$rec_count] = "$record->[8]"; + if (!$CLIlevel) + {$hopper_level[$rec_count] = "$record->[13]";} + else + {$hopper_level[$rec_count] = "$CLIlevel";} + $local_call_time[$rec_count] = "$record->[16]"; + $rec_count++; + } + } + +$i=0; +foreach(@campaign_id) + { + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + $GMT_allowed = ''; + + if ($local_call_time[$i] =~ /24hours/) + { + $p='13'; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /9am-9pm/) + { + $p='13'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 9) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /9am-5pm/) + { + $p='13'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 9) && ($hour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /12pm-5pm/) + { + $p='13'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 12) && ($hour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /12pm-9pm/) + { + $p='13'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 12) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time[$i] =~ /5pm-9pm/) + { + $p='13'; + while ($p > -13) + { + $GMT_test = ($GMT_now + ($p * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_test); + if ( ($hour >= 17) && ($hour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed .= "'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed .= "'99'"; + + + if ($DB) {print "Starting hopper run for $campaign_id[$i] campaign: GMT: $local_call_time[$1] $GMT_allowed HOPPER: $hopper_level[$i] \n";} + + ### Delete the DONE leads if there are any + $stmtA = "DELETE from vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('DONE');"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print " hopper DONE cleared: $affected_rows\n";} + + ### Delete the leads that are out of GMT time range if there are any + $stmtA = "DELETE from vicidial_hopper where campaign_id='$campaign_id[$i]' and gmt_offset_now NOT IN($GMT_allowed);"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print " hopper GMT BAD cleared: $affected_rows\n";} + + $hopper_ready_count=0; + $dbhA->query("SELECT count(*) from vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countA=0; + while ( $record = $iter->each) + { + $hopper_ready_count = $record->[0]; + if ($DB) {print " hopper READY count: $hopper_ready_count\n";} + $rec_countA++; + } + } + $event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]|$GMT_allowed|"; + &event_logger; + + ##### IF hopper level is below set minimum, then try to add more leads ##### + if ($hopper_ready_count < $hopper_level[$i]) + { + if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} + + $dbhA->query("SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countLISTS=0; + $camp_lists = ''; + while ( $record = $iter->each) + { + $camp_lists .= "'$record->[0]',"; + $rec_countLISTS++; + } + chop($camp_lists); + } + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists\n";} + + $dbhA->query("SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"); + $campaign_leads_to_call=0; + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $campaign_leads_to_call = "$record->[0]"; + if ($DB) {print " leads to call count: $campaign_leads_to_call\n";} + } + } + if ( ($lead_order[$i] eq "DOWN COUNT 2nd NEW") or ($lead_order[$i] eq "DOWN COUNT 3rd NEW") or ($lead_order[$i] eq "DOWN COUNT 4th NEW") ) + { + $dbhA->query("SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"); + $NEW_campaign_leads_to_call=0; + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $NEW_campaign_leads_to_call = "$record->[0]"; + if ($DB) {print " NEW leads to call count: $NEW_campaign_leads_to_call\n";} + } + } + } + + ##### IF no NEW leads to be called, error out of this campaign ##### + if ( ( ($lead_order[$i] eq "DOWN COUNT 2nd NEW") or ($lead_order[$i] eq "DOWN COUNT 3rd NEW") or ($lead_order[$i] eq "DOWN COUNT 4th NEW") ) && ($NEW_campaign_leads_to_call > 0) ) {$GOOD=1;} + else + { + if ($DB) {print " ERROR CANNOT ADD ANY NEW LEADS TO HOPPER\n";} + } + + ##### IF no leads to be called, error out of this campaign ##### + if ($campaign_leads_to_call < 1) + { + if ($DB) {print " ERROR CANNOT ADD ANY LEADS TO HOPPER\n";} + } + else + { + if ($DB) {print " Getting Leads to add to hopper\n";} + $dbhA->query("SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign_id[$i]';"); + $rec_countLISTS=0; + $lead_id_lists = ''; + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $lead_id_lists .= "'$record->[0]',"; + $rec_countLISTS++; + } + $lead_id_lists .= "'0'"; + } + + $order_stmt=''; + $NEW_count = 0; + $NEW_level = 0; + $OTHER_level = $hopper_level[$i]; + if ($lead_order[$i] eq "DOWN") {$order_stmt = 'order by lead_id asc';} + if ($lead_order[$i] eq "UP") {$order_stmt = 'order by lead_id desc';} + if ($lead_order[$i] eq "UP LAST NAME") {$order_stmt = 'order by last_name desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN LAST NAME") {$order_stmt = 'order by last_name, lead_id asc';} + if ($lead_order[$i] eq "UP PHONE") {$order_stmt = 'order by phone_number desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN PHONE") {$order_stmt = 'order by phone_number, lead_id asc';} + if ($lead_order[$i] eq "UP COUNT") {$order_stmt = 'order by called_count desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT") {$order_stmt = 'order by called_count, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT 2nd NEW") {$NEW_count = 2;} + if ($lead_order[$i] eq "DOWN COUNT 3rd NEW") {$NEW_count = 3;} + if ($lead_order[$i] eq "DOWN COUNT 4th NEW") {$NEW_count = 4;} + + if ($NEW_count > 0) + { + $NEW_level = int($hopper_level[$i] / $NEW_count); + $OTHER_level = ($hopper_level[$i] - $NEW_level); + $order_stmt = 'order by called_count, lead_id asc'; + if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";} + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $order_stmt limit $NEW_level;"; + # if ($DB) {print " STMT |$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $NEW_rec_countLEADS=0; + @NEW_leads_to_hopper=@MT; + @NEW_lists_to_hopper=@MT; + @NEW_phone_to_hopper=@MT; + while ( $record = $iter->each) + { + $NEW_leads_to_hopper[$NEW_rec_countLEADS] = "$record->[0]"; + $NEW_lists_to_hopper[$NEW_rec_countLEADS] = "$record->[1]"; + $NEW_gmt_to_hopper[$NEW_rec_countLEADS] = "$record->[2]"; + $NEW_phone_to_hopper[$NEW_rec_countLEADS] = "$record->[3]"; + if ($DB_show_offset) {print "LEAD_ADD: $record->[2] $record->[3] $record->[4]\n";} + $NEW_rec_countLEADS++; + } + } + + } + + + + if ($DB) {print " lead call order: $order_stmt\n";} + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $order_stmt limit $OTHER_level;"; + # if ($DB) {print " STMT |$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countLEADS=0; $NEW_dec=99; $NEW_in=0; + @leads_to_hopper=@MT; + @lists_to_hopper=@MT; + while ( $record = $iter->each) + { + if ( ($NEW_count > 0) && ($NEW_rec_countLEADS > $NEW_in) ) + { + if ($DB_show_offset) {print "NEW_COUNT: $NEW_count|$NEW_dec|$NEW_in|$NEW_rec_countLEADS\n";} + if ($NEW_count > $NEW_dec) + { + $NEW_dec++; + } + else + { + $leads_to_hopper[$rec_countLEADS] = "$NEW_leads_to_hopper[$NEW_in]"; + $lists_to_hopper[$rec_countLEADS] = "$NEW_lists_to_hopper[$NEW_in]"; + $gmt_to_hopper[$rec_countLEADS] = "$NEW_gmt_to_hopper[$NEW_in]"; + if ($DB_show_offset) {print "LEAD_ADD: $NEW_leads_to_hopper[$NEW_in] $NEW_phone_to_hopper[$NEW_in]\n";} + $rec_countLEADS++; + $NEW_in++; + $NEW_dec=2; + } + } + $leads_to_hopper[$rec_countLEADS] = "$record->[0]"; + $lists_to_hopper[$rec_countLEADS] = "$record->[1]"; + $gmt_to_hopper[$rec_countLEADS] = "$record->[2]"; + if ($DB_show_offset) {print "LEAD_ADD: $record->[2] $record->[3] $record->[4]\n";} + $rec_countLEADS++; + } + } + + if ($DB) {print " Adding to hopper: $rec_countLEADS\n";} + $event_string = "|$campaign_id[$i]|Added to hopper $rec_countLEADS|"; + &event_logger; + + $h=0; + foreach(@leads_to_hopper) + { + if ($leads_to_hopper[$h] != '0') + { + $stmtA = "INSERT INTO vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]');"; + $dbhA->query("$stmtA"); + } + $h++; + } + if ($DB) {print " DONE with this campaign\n";} + + } + } + + + $i++; + } + + +$dbhA->close; + +if($DB){print "DONE... Exiting... Goodbye... See you later... Really, I mean it :)\n";} + +exit; + + + +sub event_logger { + ### open the log file for writing ### + open(Lout, ">>$VDHLOGfile") + || die "Can't open $VDHLOGfile: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} + + diff --git a/AST_VDremote_agents.pl b/AST_VDremote_agents.pl new file mode 100644 index 0000000..a042eff --- /dev/null +++ b/AST_VDremote_agents.pl @@ -0,0 +1,493 @@ +#!/usr/bin/perl +# +# AST_VDremote_agents.pl version 0.1 +# +# DESCRIPTION: +# uses Net::MySQL to keep remote agents logged in to the VICIDIAL system +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL with remote agents, this must always be running +# +# It is recommended that you run this program on the local Asterisk machine +# +# This script is to run perpetually querying every second to update the remote +# agents that should appear to be logged in so that the calls can be transferred +# out to them properly. +# +# 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) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 50215-0954 - First version of script +# 50810-1615 - Added database server variable definitions lookup +# + +### 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 [-t] = test\n [-v] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2 seconds\n\n"; + } + else + { + if ($args =~ /--delay=/i) + { + @data_in = split(/--delay=/,$args); + $loop_delay = $data_in[1]; + print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n"; + $loop_delay = ($loop_delay * 1000); + } + else + { + $loop_delay = '2000'; + } + if ($args =~ /-v/i) + { + $V=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2000'; + $V=1; +} +### end parsing run-time options ### + + +# constants +$US='__'; +$MT[0]=''; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; + + ### connect to MySQL database defined in the AST_SERVER_conf.pl file + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBSERVER_GMT = "$record->[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + } + } + + + &get_time_now; # update time/date variables + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; # writes to the log and if debug flag is set prints to STDOUT + + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 12; # 1 month loops for one year +while($one_day_interval > 0) +{ + + $endless_loop=5760000; # 30 days minutes at XXX seconds per loop + + while($endless_loop > 0) + { + &get_time_now; + + if ($endless_loop =~ /0$|5$/) + { + ### delete call records that are LIVE for over 10 minutes and last_update_time < '$PDtsSQLdate' + $stmtA = "DELETE FROM vicidial_live_agents where server_ip='$server_ip' and status IN('PAUSED') and extension LIKE \"R/%\""; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| lagged call vla agent DELETED $affected_rows"; + &event_logger; + + + $stmtA = "UPDATE vicidial_live_agents set status='INCALL', last_call_time='$SQLdate' where server_ip='$server_ip' and status IN('QUEUE') and extension LIKE \"R/%\""; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + + $event_string = "| QUEUEd call listing vla UPDATEd $affected_rows"; + &event_logger; + + #@psoutput = `/bin/ps -f --no-headers -A`; + @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + + $running_listen = 0; + + $i=0; + foreach (@psoutput) + { + chomp($psoutput[$i]); + + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_li/) {$running_listen++;} + + $i++; + } + + if (!$running_listen) + { + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED NO LISTENER RUNNING... EXITING\n\n"; + } + + if($DB){print "checking to see if listener is dead |$running_listen|\n";} + } + + + + $user_counter=0; + @DBremote_user=@MT; + @DBremote_server_ip=@MT; + @DBremote_campaign=@MT; + @DBremote_conf_exten=@MT; + @DBremote_closer=@MT; + @DBremote_random=@MT; + @loginexistsRANDOM=@MT; + @loginexistsALL=@MT; + @VD_user=@MT; + @VD_extension=@MT; + @VD_status=@MT; + @VD_uniqueid=@MT; + @VD_callerid=@MT; + @VD_random=@MT; + ############################################################################### + ###### first grab all of the ACTIVE remote agents information from the database + ############################################################################### + $dbhA->query("SELECT * FROM vicidial_remote_agents where status IN('ACTIVE') and server_ip='$server_ip' order by user_start"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $user_start = "$record->[1]"; + $number_of_lines = "$record->[2]"; + $conf_exten = "$record->[4]"; + $campaign_id = "$record->[6]"; + $closer_campaigns = "$record->[7]"; + + $y=0; + while ($y < $number_of_lines) + { + $random = int( rand(9999999)) + 10000000; + $user_id = ($user_start + $y); + $DBremote_user[$user_counter] = "$user_id"; + $DBremote_server_ip[$user_counter] = "$server_ip"; + $DBremote_campaign[$user_counter] = "$campaign_id"; + $DBremote_conf_exten[$user_counter] = "$conf_exten"; + $DBremote_closer[$user_counter] = "$closer_campaigns"; + $DBremote_random[$user_counter] = "$random"; + + $y++; + $user_counter++; + } + + } + if ($V) {print STDERR "$user_counter live remote agents ACTIVE\n";} + } + + + ############################################################################### + ###### second traverse array of remote agents to be active and insert or update + ###### in vicidial_live_agents table + ############################################################################### + $h=0; + foreach(@DBremote_user) + { + if (length($DBremote_user[$h])>1) + { + + ### check to see if the record exists and only needs random number update + $dbhA->query("SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]'"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $loginexistsRANDOM[$h] = "$record->[0]"; + } + } + if ($loginexistsRANDOM[$h] > 0) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]' where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($V) {print STDERR "$DBremote_user[$h] $DBremote_campaign[$h] ONLY RANDOM ID UPDATE: $affected_rows\n";} + } + ### check if record for user on server exists at all in vicidial_live_agents + else + { + $dbhA->query("SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip'"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $loginexistsALL[$h] = "$record->[0]"; + } + } + if ($loginexistsALL[$h] > 0) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]',campaign_id='$DBremote_campaign[$h]',conf_exten='$DBremote_conf_exten[$h]',closer_campaigns='$DBremote_closer[$h]', status='READY' where user='$DBremote_user[$h]' and server_ip='$server_ip'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($V) {print STDERR "$DBremote_user[$h] ALL UPDATE: $affected_rows\n";} + } + ### no records exist so insert a new one + else + { + $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$tsSQLdate','$SQLdate','$DBremote_closer[$h]','','','')"; + $dbhA->query("$stmtA"); + if ($V) {print STDERR "$DBremote_user[$h] NEW INSERT\n";} + } + } + } + $h++; + } + + + ############################################################################### + ###### third validate that the calls that the vicidial_live_agents are on are not dead + ###### and if they are wipe out the values and set the agent record back to READY + ############################################################################### + $dbhA->query("SELECT user,extension,status,uniqueid,callerid FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid > 10"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $z=0; + while ( $record = $iter->each) + { + $VDuser = "$record->[0]"; + $VDextension = "$record->[1]"; + $VDstatus = "$record->[2]"; + $VDuniqueid = "$record->[3]"; + $VDcallerid = "$record->[4]"; + $VDrandom = int( rand(9999999)) + 10000000; + + $VD_user[$z] = "$VDuser"; + $VD_extension[$z] = "$VDextension"; + $VD_status[$z] = "$VDstatus"; + $VD_uniqueid[$z] = "$VDuniqueid"; + $VD_callerid[$z] = "$VDcallerid"; + $VD_random[$z] = "$VDrandom"; + + $z++; + } + if ($V) {print STDERR "$z remote agents on calls\n";} + } + $z=0; + foreach(@VD_user) + { + $dbhA->query("SELECT count(*) FROM vicidial_auto_calls where uniqueid='$VD_uniqueid[$z]' and server_ip='$server_ip'"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $autocallexists[$z] = "$record->[0]"; + } + } + if ($autocallexists[$z] < 1) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='READY', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip'"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($V) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|$VD_uniqueid[$z]\n";} + } + + $z++; + } + + + + + + + ############################################################################### + ###### last, wait for a little bit and repeat the loop + ############################################################################### + + ### sleep for X seconds before beginning the loop again + usleep(1*$loop_delay*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program + if (-e '/home/cron/VDAD.kill') + { + unlink('/home/cron/VDAD.kill'); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + + $bad_grabber_counter=0; + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->close; + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ + $secX = time(); +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $filedate = "$year-$mon-$mday"; + +$BDtarget = ($secX - 10); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +$PDtarget = ($secX - 30); +($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget); +$Pyear = ($Pyear + 1900); +$Pmon++; +if ($Pmon < 10) {$Pmon = "0$Pmon";} +if ($Pmday < 10) {$Pmday = "0$Pmday";} +if ($Phour < 10) {$Phour = "0$Phour";} +if ($Pmin < 10) {$Pmin = "0$Pmin";} +if ($Psec < 10) {$Psec = "0$Psec";} + $PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec"; + +$XDtarget = ($secX - 120); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 600); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +} + + + + + +sub event_logger +{ + +if ($DB) {print "$now_date|$event_string|\n";} + ### open the log file for writing ### + open(Lout, ">>/home/cron/remote.$filedate") + || die "Can't open /home/cron/remote.$filedate: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} diff --git a/AST_cleanup_agent_log.pl b/AST_cleanup_agent_log.pl new file mode 100644 index 0000000..7f405a0 --- /dev/null +++ b/AST_cleanup_agent_log.pl @@ -0,0 +1,236 @@ +#!/usr/bin/perl +# +# AST_cleanup_agent_log.pl version 0.1 +# +# DESCRIPTION: +# to be run frequently to clean up the vicidial_agent_log to fix erroneous time +# calculations due to out-of-order vicidial_agent_log updates. This happens 0.5% +# of the time in our test setups, but that leads to inaccurate time logs so we +# wrote this script to fix the miscalculations +# +# This program only needs to be run by one server +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + + +# constants +$COUNTER_OUTPUT=1; # set to 1 to display the counter as the script runs +$US='__'; +$MT[0]=''; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + print "\n----- DEBUGGING -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + print "\n----- TEST RUN, NO UPDATES -----\n\n"; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + + if ($DB) {print " - cleaning up pause time\n";} + ### Grab any pause time record greater than 50000 + $stmtA = "SELECT agent_log_id,pause_epoch,wait_epoch from vicidial_agent_log where pause_sec>50000;"; + if ($DBX) {print "$stmtA\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $i=0; + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBout = ''; + $agent_log_id[$i] = "$record->[0]"; + $pause_epoch[$i] = "$record->[1]"; + $wait_epoch[$i] = "$record->[2]"; + $pause_sec[$i] = int($wait_epoch[$i] - $pause_epoch[$i]); + if ( ($pause_sec[$i] < 0) || ($pause_sec[$i] > 50000) ) + { + $DBout = "Override output: $pause_sec[$i]"; + $pause_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$wait_epoch[$i]|$pause_epoch[$i]|$pause_sec[$i]|$DBout|\n";} + $i++; + } + } + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set pause_sec='$pause_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$TEST) {$dbhA->query($stmtA); }# or die "Couldn't execute query: |$stmtA|\n"; + $h++; + } + if ($DB) {print STDERR " Pause times fixed: $h\n";} + + + + + + @agent_log_id=@MT; + @wait_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up wait time\n";} + ### Grab any pause time record greater than 50000 + $stmtA = "SELECT agent_log_id,wait_epoch,talk_epoch from vicidial_agent_log where wait_sec>50000;"; + if ($DBX) {print "$stmtA\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $i=0; + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBout = ''; + $agent_log_id[$i] = "$record->[0]"; + $wait_epoch[$i] = "$record->[1]"; + $talk_epoch[$i] = "$record->[2]"; + $wait_sec[$i] = int($talk_epoch[$i] - $wait_epoch[$i]); + if ( ($wait_sec[$i] < 0) || ($wait_sec[$i] > 50000) ) + { + $DBout = "Override output: $wait_sec[$i]"; + $wait_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$talk_epoch[$i]|$wait_epoch[$i]|$wait_sec[$i]|$DBout|\n";} + $i++; + } + } + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set wait_sec='$wait_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$TEST) {$dbhA->query($stmtA); }# or die "Couldn't execute query: |$stmtA|\n"; + $h++; + } + if ($DB) {print STDERR " Wait times fixed: $h\n";} + + + + + + @agent_log_id=@MT; + @talk_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up talk time\n";} + ### Grab any pause time record greater than 50000 + $stmtA = "SELECT agent_log_id,talk_epoch,dispo_epoch from vicidial_agent_log where talk_sec>50000;"; + if ($DBX) {print "$stmtA\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $i=0; + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBout = ''; + $agent_log_id[$i] = "$record->[0]"; + $talk_epoch[$i] = "$record->[1]"; + $dispo_epoch[$i] = "$record->[2]"; + $talk_sec[$i] = int($dispo_epoch[$i] - $talk_epoch[$i]); + if ( ($talk_sec[$i] < 0) || ($talk_sec[$i] > 50000) ) + { + $DBout = "Override output: $talk_sec[$i]"; + $talk_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$dispo_epoch[$i]|$talk_epoch[$i]|$talk_sec[$i]|$DBout|\n";} + $i++; + } + } + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set talk_sec='$talk_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "|$stmtA|\n";} + if (!$TEST) {$dbhA->query($stmtA); }# or die "Couldn't execute query: |$stmtA|\n"; + $h++; + } + if ($DB) {print STDERR " Talk times fixed: $h\n";} + + + + + + @agent_log_id=@MT; + @dispo_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up dispo time\n";} + $stmtA = "UPDATE vicidial_agent_log set dispo_sec='0' where dispo_sec>50000;"; + if($DBX){print STDERR "|$stmtA|\n";} + if (!$TEST) + { + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + $affected_rows = $dbhA->get_affected_rows_length; + } + if ($DB) {print STDERR " Bad Dispo times zeroed out: $affected_rows\n";} + + + + + + + + + + + + if ($DB) {print STDERR "\nDONE\n";} + + + + $dbhA->close; + + +exit; + + + + + + diff --git a/AST_conf_update.pl b/AST_conf_update.pl new file mode 100644 index 0000000..70d874a --- /dev/null +++ b/AST_conf_update.pl @@ -0,0 +1,220 @@ +#!/usr/bin/perl +# +# AST_conf_update.pl version 0.3 +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update whether a conference +# is still in use or not. If not in use 3 times in a row the extension in the +# conferences DB record is erased freeing that conference to be used again +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with conferences +# +# This program should be in the cron running every minute (like AST_vm_update.pl) +# +# For this program to work you need to have the "asterisk" MySQL database +# created with the conferences table in it, also make sure +# that the account running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute there is a theoretical limit of +# 600 conferences that it can check due to the wait interval. If you have +# more than this either change the cron when this script is run or change the +# wait interval below +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50810-1532 - Added database server variable definitions lookup +# 50823-1456 - Added commandline arguments for debug at runtime +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages per minute +$US='__'; +$MT[0]=''; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; +use Net::Telnet (); + + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + + + +@PTextensions=@MT; @PT_conf_extens=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; +$dbhA->query("SELECT extension,conf_exten from conferences where server_ip='$server_ip' and extension is NOT NULL and extension != '';"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + $PTextensions[$rec_count] = "$record->[0]"; + $PT_conf_extens[$rec_count] = "$record->[1]"; + $rec_count++; + } + } + +if (!$telnet_port) {$telnet_port = '5038';} + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + @list_channels = $t->cmd(String => "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/'); + + $j=0; + $conf_empty[$i]=0; + $conf_users[$i]=''; + foreach(@list_channels) + { + if($DB){print "|$list_channels[$j]|\n";} + if ($list_channels[$j] =~ /No active conferences|No such conference/i) + {$conf_empty[$i]++;} +# if ($list_channels[$j] =~ /^User /i) +# { +# $userx = ''; +# $userx = $list_channels[$j]; +# $userx =~ s/User \#: //gi; +# $conf_users[$i] .= "$userx|"; +# } + $j++; + } + + if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";} + if (!$conf_empty[$i]) + { + if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";} + if ($PTextensions[$i] =~ /Xtimeout\d$/i) + { + $PTextensions[$i] =~ s/Xtimeout\d$//gi; + $stmtA = "UPDATE conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:|$stmtA|\n"; + } + } + else + { + $NEWexten[$i] = $PTextensions[$i]; + if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;} + if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;} + if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = '';} + if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';} + + + $stmtA = "UPDATE conferences set extension='$NEWexten[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:|$stmtA|\n"; + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + +$dbhA->close; + +if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + +exit; + + + + diff --git a/AST_flush_DBqueue.pl b/AST_flush_DBqueue.pl new file mode 100644 index 0000000..cf76ffa --- /dev/null +++ b/AST_flush_DBqueue.pl @@ -0,0 +1,189 @@ +#!/usr/bin/perl +# +# AST_flush_DBqueue.pl version 0.2 +# +# DESCRIPTION: +# - clears out mysql records for this server for the ACQS vicidial_manager table +# - optimizes tables used frequently by VICIDIAL +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $yy = $year; $yy =~ s/^..//gi; + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} +$SQLdate_NOW="$year-$mon-$mday $hour:$min:$sec"; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time()-3600); + $year = ($year + 1900); + $yy = $year; $yy =~ s/^..//gi; + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} +$SQLdate_NEG_1hour="$year-$mon-$mday $hour:$min:$sec"; + +### 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 [-q] = quiet\n [-t] = test\n [--debug] = debugging messages\n\n"; + } + else + { + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /-t|--test/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +if (!$Q) {print "TEST\n\n";} +if (!$Q) {print "NOW DATETIME: $SQLdate_NOW\n";} +if (!$Q) {print "1 HOUR AGO DATETIME: $SQLdate_NEG_1hour\n\n";} + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + + $stmtA = "delete from vicidial_manager where server_ip='$server_ip' and entry_date < '$SQLdate_NEG_1hour';"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if (!$Q) {print " - vicidial_manager 2 hour flush\n";} + + + $stmtA = "update park_log set status='HUNGUP' where hangup_time is not null;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + while ($recordA = $iterA->each) + { + if (!$Q) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + if (!$Q) {print " - park_log HUNGUP flush \n";} + + + $stmtA = "optimize table vicidial_manager;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + while ($recordA = $iterA->each) + { + if (!$Q) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + if (!$Q) {print " - optimize vicidial_manager \n";} + + + $stmtA = "optimize table vicidial_live_agents;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + while ($recordA = $iterA->each) + { + if (!$Q) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + if (!$Q) {print " - optimize vicidial_live_agents \n";} + + + $stmtA = "optimize table vicidial_auto_calls;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + while ($recordA = $iterA->each) + { + if (!$Q) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + if (!$Q) {print " - optimize vicidial_auto_calls \n";} + + + $stmtA = "optimize table vicidial_hopper;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) {$dbhA->query($stmtA); } + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + $rec_countY=0; + while ($recordA = $iterA->each) + { + if (!$Q) {print "|",$recordA->[0],"|",$recordA->[1],"|",$recordA->[2],"|",$recordA->[3],"|","\n";} + } + } + + if (!$Q) {print " - optimize vicidial_hopper \n";} + + + + + $dbhA->close; + + +exit; + + + + + + diff --git a/AST_manager_kill_hung_congested.pl b/AST_manager_kill_hung_congested.pl new file mode 100644 index 0000000..52636af --- /dev/null +++ b/AST_manager_kill_hung_congested.pl @@ -0,0 +1,335 @@ +#!/usr/bin/perl +# +# AST_manager_kill_hung_congested.pl version 0.2 +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# kills CONGEST local channels every 15 seconds +# +# For the client program to work in ACQS mode, this program must be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# put this in the cron to run every minute +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50823-1525 - Added commandline debug options with debug printouts +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate thousands of lines of output per minute +$US='__'; +$MT[0]=''; + + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + + + &get_time_now; + +# $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; +# &event_logger; + +#use lib './lib', '../lib'; +use Net::MySQL; +#use Net::Telnet (); + +my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass") +or die "Couldn't connect to database: \n"; + +#$event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; +#&event_logger; + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"\n";} + $congest_kill[$rec_count] = "$record->[0]"; + $rec_count++; + } + + } + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + } + $i++; + } + + +sleep(14); + +######## 22222 starting another loop + &get_time_now; +@congest_kill = @MT; + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"\n";} + $congest_kill[$rec_count] = "$record->[0]"; + $rec_count++; + } + + } + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + } + $i++; + } + + +sleep(15); + +######## 33333 starting another loop + &get_time_now; +@congest_kill = @MT; + + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"\n";} + $congest_kill[$rec_count] = "$record->[0]"; + $rec_count++; + } + + } + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + } + $i++; + } + + +sleep(15); + +######## 44444 starting another loop + &get_time_now; +@congest_kill = @MT; + + + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"\n";} + $congest_kill[$rec_count] = "$record->[0]"; + $rec_count++; + } + + } + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + } + $i++; + } + + + +# $event_string='CLOSING DB CONNECTION|'; +# &event_logger; + + $dbhA->close; + + + if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + + +exit; + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; +$CIDdate = "$year$mon$mday$hour$min$sec"; +} + + + + + +sub event_logger { + ### open the log file for writing ### + open(Lout, ">>$KHLOGfile") + || die "Can't open $KHLOGfile: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} diff --git a/AST_manager_listen.pl b/AST_manager_listen.pl new file mode 100644 index 0000000..2a8945c --- /dev/null +++ b/AST_manager_listen.pl @@ -0,0 +1,526 @@ +#!/usr/bin/perl +# +# AST_manager_listen.pl version 1.1.9 build 51222-1553 +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# connects to the Asterisk Manager interface and updates records in the +# vicidial_manager table of the asterisk database in MySQL based upon the +# events that it receives +# +# SUMMARY: +# This program was designed as the listen-only part of the ACQS. It's job is to +# look for certain events and based upon either the uniqueid or the callerid of +# the call update the status and information of an action record in the +# vicidial_manager table of the asterisk MySQL database. +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# Both - Net::MySQL, Net::Telnet and Time::HiRes perl modules loaded +# +# For the client program to work in ACQS mode, this program must be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 50322-1300 changed callerid parsing to remove quotes and number +# 50616-1559 Added NewCallerID parsing and updating +# 50621-1406 Added Asterisk server shutdown and connection dead detection +# 50810-1534 Added database server variable definitions lookup +# 50824-1606 Altered CVS/1.2 support for different output +# 50901-2359 Another CVS/1.2 output parsing fix +# 51222-1553 fixed parentheses bug in manager output +# + +# constants +$DB=1; # Debug flag, set to 0 for no debug messages, lots of output +$US='__'; +$MT[0]=''; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + + &get_time_now; + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; + +#use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; +use Net::Telnet (); + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + + +if (!$telnet_port) {$telnet_port = '5038';} + +$one_day_interval = 90; # 1 day loops for 3 months +while($one_day_interval > 0) +{ + + $event_string="STARTING NEW MANAGER TELNET CONNECTION||ATTEMPT|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; +# Errmode => Return, + + ### connect to asterisk manager through telnet + $tn = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); + #$fh = $tn->dump_log("$LItelnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMElisten) > 3) {$telnet_login = $ASTmgrUSERNAMElisten;} + else {$telnet_login = $ASTmgrUSERNAME;} + $tn->open("$telnet_host"); + $tn->waitfor('/0\n$/'); # print login + $tn->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $tn->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $tn->buffer_empty; + + $event_string="STARTING NEW MANAGER TELNET CONNECTION|$telnet_login|CONFIRMED CONNECTION|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + $endless_loop=864000; # 1 day at .10 seconds per loop + + while($endless_loop > 0) + { + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + + $msg=''; + $read_input_buf = $tn->get(Errmode => Return, Timeout => 1,); + $input_buf_length = length($read_input_buf); + $msg = $tn->errmsg; + if ($msg =~ /filehandle isn\'t open/i) + { + $endless_loop=0; + $one_day_interval=0; + print "ERRMSG: |$msg|\n"; + print "\nAsterisk server shutting down, PROCESS KILLED... EXITING\n\n"; + $event_string="Asterisk server shutting down, PROCESS KILLED... EXITING|ONE DAY INTERVAL:$one_day_interval|$msg|"; + &event_logger; + } + + if ( ($read_input_buf !~ /\n\n/) or ($input_buf_length < 10) ) + { + # if ($read_input_buf =~ /\n/) {print "\n|||$input_buf_length|||$read_input_buf|||\n";} + $input_buf = "$input_buf$read_input_buf"; + } + else + { + $partial=0; + $partial_input_buf=''; + + if ($read_input_buf !~ /\n\n$/) + { + $read_input_buf =~ s/\(|\)/ /gi; # replace parens with space + $partial_input_buf = $read_input_buf; + $partial_input_buf =~ s/\n/-----/gi; + $partial_input_buf =~ s/\*/\\\*/gi; + $partial_input_buf =~ s/.*----------//gi; + $partial_input_buf =~ s/-----/\n/gi; + $read_input_buf =~ s/$partial_input_buf$//gi; + $partial++; + } + + +# |1 DIALINGs updated| +# Nested quantifiers in regex; marked by <-- HERE in m/Event: Newexten +# Channel: Zap/16-1 +# Context: demo +# Extension: 990009*CL_UMGCOF_L** <-- HERE 1479503*conf*** +# Priority: 2 +# Application: Dial +# AppData: Zap/g3/90009*CL_UMGCOF_L**1479503*conf***|20 +# Uniqueid: 1101224775.6783 +# $/ at /home/cron/AST_manager_listen.pl line 114. + + + $input_buf = "$input_buf$read_input_buf"; + @input_lines = split(/\n\n/, $input_buf); + + if($DB){print "input buffer: $input_buf_length lines: $#input_lines partial: $partial\n";} + if ( ($DB) && ($partial) ) {print "-----[$partial_input_buf]-----\n\n";} + if($DB){print "|$input_buf|\n";} + + $manager_string = "$input_buf"; + &manager_output_logger; + + $input_buf = "$partial_input_buf"; + + + @command_line=@MT; + $ILcount=0; + foreach(@input_lines) + { + if ( ($input_lines[$ILcount] =~ /State: Ringing|State: Up|State: Dialing|Event: Newstate|Event: Hangup|Event: Newcallerid|Event: Shutdown/) && ($input_lines[$ILcount] !~ /ZOMBIE/) ) + { + $input_lines[$ILcount] =~ s/^\n|^\n\n//gi; + @command_line=split(/\n/, $input_lines[$ILcount]); + if ($input_lines[$ILcount] =~ /Event: Shutdown/) + { + $endless_loop=0; + $one_day_interval=0; + print "\nAsterisk server shutting down, PROCESS KILLED... EXITING\n\n"; + $event_string="Asterisk server shutting down, PROCESS KILLED... EXITING|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + } + + if ($input_lines[$ILcount] =~ /Event: Hangup/) + { + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[3] =~ /^Uniqueid: /i) ) ### post 2005-08-07 CVS + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $uniqueid = $command_line[3]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='DEAD', channel='$channel' where server_ip = '$server_ip' and uniqueid = '$uniqueid'"; + + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows HANGUPS updated|\n";} + } + else + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $uniqueid = $command_line[2]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='DEAD', channel='$channel' where server_ip = '$server_ip' and uniqueid = '$uniqueid'"; + + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows HANGUPS updated|\n";} + } + } + + if ($input_lines[$ILcount] =~ /State: Dialing/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^Uniqueid: /i) ) ### pre 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[3]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[4]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^CalleridName: /i) ) ### post 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[4]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[5]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^CalleridName: /i) ) ### post 2005-08-07 CVS + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + } + if ($input_lines[$ILcount] =~ /State: Ringing|State: Up/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^Uniqueid: /i) ) ### pre 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[3]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[4]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^CalleridName: /i) ) ### post 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[4]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[5]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^CalleridName: /i) ) ### post 2005-08-07 CVS + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + } + + if ($input_lines[$ILcount] =~ /Event: Newcallerid/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[3] =~ /^Uniqueid: /i) ) + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[2]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[3]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel =~ /local/i) + { + print STDERR "|$stmtA|\n"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + } + + } + $ILcount++; + } + + } + + + $endless_loop--; + $keepalive_count_loop++; + if($DB){print STDERR "loop counter: |$endless_loop|$keepalive_count_loop|\r";} + + ### putting a blank file called "sendmgr.kill" in a directory will automatically safely kill this program + if ( (-e '/home/cron/listenmgr.kill') or ($sendonlyone) ) + { + unlink('/home/cron/listenmgr.kill'); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n"; + } + + ### run a keepalive command to flush whatever is in the buffer through and to keep the connection alive + if ($endless_loop =~ /00$|50$/) + { + &get_time_now; + + @list_lines = $tn->cmd(String => "Action: Command\nCommand: show uptime\n\n", Prompt => '/--END COMMAND--.*/', Errmode => Return, Timeout => 1); + if($DB){print "input lines: $#list_lines\n";} + + if($DB){print "+++++++++++++++++++++++++++++++sending keepalive transmit line $endless_loop|$now_date|\n";} + $keepalive_count_loop=0; + } + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...$one_day_interval left\n";} + + $event_string='HANGING UP|'; + &event_logger; + + @hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/", Errmode => Return, Timeout => 1); + + $ok = $tn->close; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->close; + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; +} + + + + + +sub event_logger { + ### open the log file for writing ### + open(Lout, ">>$LILOGfile") + || die "Can't open $LILOGfile: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} + + + + +sub manager_output_logger +{ +open(MOout, ">>/home/cron/listen.$action_log_date") + || die "Can't open /home/cron/listen.$action_log_date: $!\n"; + + print MOout "$now_date|$manager_string|\n"; + + close(MOout); +} diff --git a/AST_manager_send.pl b/AST_manager_send.pl new file mode 100644 index 0000000..222b6a9 --- /dev/null +++ b/AST_manager_send.pl @@ -0,0 +1,384 @@ +#!/usr/bin/perl +# +# AST_manager_send.pl version 0.2 +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# spawns child processes (AST_send_action_child.pl) to execute action commands +# on the Asterisk manager interface from records in the vicidial_manager table +# of the asterisk database in MySQL that are marked as a status of NEW +# +# SUMMARY: +# This program was designed as the send-only part of the ACQS. It's job is to +# pick NEW actions from the vicidial_manager table and send them to be executed +# by separate child process. This allows for a higher degree of flexibility and +# scalability over just using a single process. Also, this means that a single +# action execution lock cannot bring the entire system down. +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# Both - Net::MySQL, Net::Telnet and Time::HiRes perl modules loaded +# +# For the client program to work in ACQS mode, this program must be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50823-1514 - Added commandline debug options with debug printouts +# 50902-1051 - Added extra debug output launch sub(commented out) +# + +# constants +$COUNTER_OUTPUT=1; # set to 1 to display the counter as the script runs +$US='__'; +$MT[0]=''; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-sendonlyone/i) + { + $sendonlyone=1; + print "\n-----SEND ONLY ONE COMMAND -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + + &get_time_now; + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; + +#use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; +#use Net::Telnet (); + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 90; # 1 day loops for 3 months +while($one_day_interval > 0) +{ + + + $endless_loop=864000; # 10 days at .20 seconds per loop + + while($endless_loop > 0) + { + + $affected_rows=0; + $NEW_actions=0; + + $stmtA = "SELECT count(*) from vicidial_manager where server_ip = '$server_ip' and status = 'NEW'"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0]," NEW Actions to send on server $server_ip $endless_loop\n";} + $NEW_actions = "$record->[0]"; + } + } + + if (!$NEW_actions) + { + $affected_rows=0; + } + else + { + $stmtA = "UPDATE vicidial_manager set status='QUEUE' where server_ip = '$server_ip' and status = 'NEW' order by entry_date limit 1"; + $dbhA->query("$stmtA"); + $affected_rows = $dbhA->get_affected_rows_length; + if ($DB) {print STDERR "rows updated to QUEUE: |$affected_rows|\n";} + } + + + if ($affected_rows) + { + $stmtA = "SELECT * FROM vicidial_manager where server_ip = '$server_ip' and status = 'QUEUE' order by entry_date desc limit 1"; + $event_string="SQL_QUERY|$stmtA|"; + &event_logger; + + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"|", $record->[1],"|", $record->[6],"|", $record->[7],"|", $record->[8],"\n";} + $man_id = "$record->[0]"; + $uniqueid = "$record->[1]"; + $channel = "$record->[6]"; + $action = "$record->[7]"; + $callid = "$record->[8]"; + $cmd_line_b = "$record->[9]"; + $cmd_line_c = "$record->[10]"; + $cmd_line_d = "$record->[11]"; + $cmd_line_e = "$record->[12]"; + $cmd_line_f = "$record->[13]"; + $cmd_line_g = "$record->[14]"; + $cmd_line_h = "$record->[15]"; + $cmd_line_i = "$record->[16]"; + $cmd_line_j = "$record->[17]"; + $cmd_line_k = "$record->[18]"; + + $originate_command = ''; + $originate_command .= "Action: $action\n"; + if (length($cmd_line_b)>3) {$originate_command .= "$cmd_line_b\n";} + if (length($cmd_line_c)>3) {$originate_command .= "$cmd_line_c\n";} + if (length($cmd_line_d)>3) {$originate_command .= "$cmd_line_d\n";} + if (length($cmd_line_e)>3) {$originate_command .= "$cmd_line_e\n";} + if (length($cmd_line_f)>3) {$originate_command .= "$cmd_line_f\n";} + if (length($cmd_line_g)>3) {$originate_command .= "$cmd_line_g\n";} + if (length($cmd_line_h)>3) {$originate_command .= "$cmd_line_h\n";} + if (length($cmd_line_i)>3) {$originate_command .= "$cmd_line_i\n";} + if (length($cmd_line_j)>3) {$originate_command .= "$cmd_line_j\n";} + if (length($cmd_line_k)>3) {$originate_command .= "$cmd_line_k\n";} + $originate_command .= "\n"; + + $SENDNOW=1; + if ($originate_command =~ /Action: Hangup|Action: Redirect/) + { + $SENDNOW=0; + if($DB){print STDERR "\n|checking for dead call before executing|$callid|$uniqueid|\n";} + $dbhA->query("SELECT count(*) FROM vicidial_manager where server_ip = '$server_ip' and callerid='$callid' and status = 'DEAD'"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countH=0; + while ( $record = $iter->each) + { + $rec_countH = "$record->[0]"; + } + if (!$rec_countH){$SENDNOW=1;} + else + { + $launch_string = "|not sending command line is dead|$callid|$uniqueid|"; + # &launch_logger; + if($DB){print STDERR "\n$launch_string\n";} + + } + } + + } + + $event_string="----BEGIN NEW COMMAND----\n$originate_command----END NEW COMMAND----\n"; + &event_logger; + + if ($SENDNOW) + { + # $tn->buffer_empty; + + $launch_string = "/home/cron/AST_send_action_child.pl --data1=$man_id $callid $uniqueid $channel"; + # &launch_logger; + + system("/home/cron/AST_send_action_child.pl --data1=$man_id >> /home/cron/action.$action_log_date \&"); + + $launch_string = "SENT $man_id $callid $uniqueid $channel"; + # &launch_logger; + + $stmtA = "UPDATE vicidial_manager set status='SENT' where man_id='$man_id'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + $event_string="SQL_QUERY|$stmtA|"; + &event_logger; + } + else + { + $stmtA = "UPDATE vicidial_manager set status='DEAD' where man_id='$man_id'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + $event_string="COMMAND NOT SENT, SQL_QUERY|$stmtA|"; + &event_logger; + } + + } + } + + } + + if ($affected_rows) + { + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + else + { + ### sleep for 20 hundredths of a second + usleep(1*200*1000); + } + + $endless_loop--; + if( ($COUNTER_OUTPUT) or ($DB) ){print STDERR "loop counter: |$endless_loop|\r";} + + ### putting a blank file called "sendmgr.kill" in a directory will automatically safely kill this program + if ( (-e '/home/cron/sendmgr.kill') or ($sendonlyone) ) + { + unlink('/home/cron/sendmgr.kill'); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n"; + } + + if ($endless_loop =~ /0$/) + { + &get_time_now; + + if( ($COUNTER_OUTPUT) or ($DB) ){print "checking to see if listener is dead |$sendonlyone|$running_listen|\n";} + #@psoutput = `/bin/ps -f --no-headers -A`; + @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + + $running_listen = 0; + + $i=0; + foreach (@psoutput) + { + chomp($psoutput[$i]); + + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_li/) + { + $running_listen++; + if ($DB) {print "SEND RUNNING: |$psline[1]|\n";} + } + + $i++; + } + + if (!$running_listen) + { + $sendonlyone++; + if( ($COUNTER_OUTPUT) or ($DB) ){print "LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT\n";} + $event_string='LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT|'; + &event_logger; + `/usr/bin/at now < /home/cron/ADMIN_keepalive_send_listen.at 2>/dev/null 1>&2`; + } + } + + + } + + + if( ($COUNTER_OUTPUT) or ($DB) ){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...$one_day_interval left\n";} + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->close; + + + if( ($COUNTER_OUTPUT) or ($DB) ){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; +} + + + + + +sub event_logger { + ### open the log file for writing ### + open(Lout, ">>$MSLOGfile") + || die "Can't open $MSLOGfile: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} + +sub launch_logger { + ### open the log file for writing ### + open(LLout, ">>/home/cron/action_launch.$action_log_date") + || die "Can't open /home/cron/action_launch.$action_log_date: $!\n"; + + print LLout "$now_date|$launch_string|\n"; + + close(LLout); + +$event_string=''; +} diff --git a/AST_reset_mysql_vars.pl b/AST_reset_mysql_vars.pl new file mode 100644 index 0000000..0409266 --- /dev/null +++ b/AST_reset_mysql_vars.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl +# +# AST_reset_mysql_vars.pl version 0.2 +# +# !!! DO NOT RUN THIS WHILE THERE ARE ACTIVE CALLS ON THE ASTERISK SERVER !!! +# +# DESCRIPTION: +# clears out mysql records for this server +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + + $stmtA = "UPDATE conferences set extension='' where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - conferences reset\n"; + + $stmtA = "UPDATE vicidial_conferences set extension='' where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_conferences reset\n"; + +# $stmtA = "UPDATE vicidial_manager set status='DEAD' where server_ip='$server_ip' and status='NEW';"; +# if($DB){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; +# print " - vicidial_manager queue reset\n"; + + $stmtA = "DELETE from vicidial_manager where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_manager delete\n"; + + $stmtA = "DELETE from vicidial_auto_calls where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_manager delete\n"; + + $stmtA = "DELETE from vicidial_live_agents where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_manager delete\n"; + + $stmtA = "DELETE from vicidial_users where full_name='5555';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_manager delete\n"; + + $dbhA->close; + + +exit; + + + + + + diff --git a/AST_send_action_child.pl b/AST_send_action_child.pl new file mode 100644 index 0000000..b15eb8b --- /dev/null +++ b/AST_send_action_child.pl @@ -0,0 +1,258 @@ +#!/usr/bin/perl +# +# AST_send_action_child.pl version 0.2 +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# This script is spawned every time an action is to be executed by the main +# AST_manager_send.pl script and sends actions blindly to the Asterisk manager +# +# SUMMARY: +# This program was designed as the blind-send part of the ACQS. It's job is to +# be spawned by the AST_manager_send.pl script lookup the record in the MySQL DB +# to be executed. connect to the manager interface, send the action and logoff +# then exit. +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# Both - Net::MySQL, Net::Telnet and Time::HiRes perl modules loaded +# +# For the client program to work in ACQS mode, this program must be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50810-1547 - Added database server variable definitions lookup +# 50823-1527 - Altered commandline debug options with debug printouts +# 50902-1032 - Changed default logging to fulllog +# + +$FULL_LOG = 1; # set to 1 for a full response log to be created in /home/cron/action_full.date + +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $ARGS = "$ARGS $ARGV[$i]\n"; + $i++; + } + +# print "DB0: |$ARGS|$#ARGV|$i|\n"; + + if ($ARGS =~ /--help/i) + { + print "allowed run time options:\n [-debug] = debug output\n [-debugX] = Extra-debug output\n [-fulllog] = full response logging\n [--data1=XXXXXXX] = vicidial_manager record\n\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-fulllog/i) + { + $FULL_LOG=1; # Full response logging enabled + } + if ($ARGS =~ /--data1=/i) + { + $data1 = $ARGS; +# print "DB1: |$ARGS|\n"; + $data1 =~ s/^.*--data1=//gi; +# print "DB2: |$data1|\n"; + $data1 =~ s/ .*$//gi; +# print "DB3: |$data1|\n"; + } + + } +} +else +{ +#print "no command line options set\n\n"; +} + +if (length($data1)>1) + { +# print "Data1 value = |$data1|\n"; + +use Net::MySQL; +use Net::Telnet (); + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + ### Grab Server values from the database + $stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEsend FROM servers where server_ip = '$server_ip';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEsend = "$record->[4]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + } + } + + + $stmtA = "SELECT * FROM vicidial_manager where man_id = '$data1'"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + $man_id = "$record->[0]"; + $uniqueid = "$record->[1]"; + $channel = "$record->[6]"; + $action = "$record->[7]"; + $callid = "$record->[8]"; + $cmd_line_b = "$record->[9]"; + $cmd_line_c = "$record->[10]"; + $cmd_line_d = "$record->[11]"; + $cmd_line_e = "$record->[12]"; + $cmd_line_f = "$record->[13]"; + $cmd_line_g = "$record->[14]"; + $cmd_line_h = "$record->[15]"; + $cmd_line_i = "$record->[16]"; + $cmd_line_j = "$record->[17]"; + $cmd_line_k = "$record->[18]"; + + $originate_command = ''; + $originate_command .= "Action: $action\n"; + if (length($cmd_line_b)>3) {$originate_command .= "$cmd_line_b\n";} + if (length($cmd_line_c)>3) {$originate_command .= "$cmd_line_c\n";} + if (length($cmd_line_d)>3) {$originate_command .= "$cmd_line_d\n";} + if (length($cmd_line_e)>3) {$originate_command .= "$cmd_line_e\n";} + if (length($cmd_line_f)>3) {$originate_command .= "$cmd_line_f\n";} + if (length($cmd_line_g)>3) {$originate_command .= "$cmd_line_g\n";} + if (length($cmd_line_h)>3) {$originate_command .= "$cmd_line_h\n";} + if (length($cmd_line_i)>3) {$originate_command .= "$cmd_line_i\n";} + if (length($cmd_line_j)>3) {$originate_command .= "$cmd_line_j\n";} + if (length($cmd_line_k)>3) {$originate_command .= "$cmd_line_k\n";} + $originate_command .= "\n"; + } + } + + $dbhA->close; + + + print "$now_date|$data1|\n$originate_command"; + $event_string = "0|$data1|"; + $event_string .= "\n$originate_command"; + if ($FULL_LOG) {&full_event_logger;} + +if (!$telnet_port) {$telnet_port = '5038';} + + ### connect to asterisk manager through telnet + $tn = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '', + Errmode => Return,); + #$fh = $tn->dump_log("$MStelnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + $tn->open("$telnet_host"); + $tn->waitfor('/0\n$/'); # print login + $tn->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $tn->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $tn->buffer_empty; + + @list_channels = $tn->cmd(String => "$originate_command", Prompt => '/.*/'); + +sleep(3); + + if ($FULL_LOG) + { + $event_string = "1|$data1|"; $k=0; + foreach(@list_channels) {$event_string .= "$list_channels[$k]"; $k++;} + $read_input_buf = $tn->get(Errmode => Return, Timeout => 1,); + $event_string .= "$read_input_buf"; + &full_event_logger; + } + + $tn->buffer_empty; + + @hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); + +sleep(2); + + if ($FULL_LOG) + { + $event_string = "2|$data1|"; $k=0; + foreach(@list_channels) {$event_string .= "$list_channels[$k]"; $k++;} + $read_input_buf = $tn->get(Errmode => Return, Timeout => 1,); + $event_string .= "$read_input_buf"; + &full_event_logger; + } + + $tn->buffer_empty; + + $ok = $tn->close; + + + + + } + +$secZ = time(); +$script_time = ($secZ - $secX); +print "DONE execute time: $script_time seconds\n"; + +exit; + +sub full_event_logger { + ### open the log file for writing ### + open(Lout, ">>/home/cron/action_full.$action_log_date") + || die "Can't open /home/cron/action_full.$action_log_date: $!\n"; + + print Lout "$now_date|$event_string|\n"; + + close(Lout); + +$event_string=''; +} diff --git a/AST_update.pl b/AST_update.pl new file mode 100644 index 0000000..2ec731e --- /dev/null +++ b/AST_update.pl @@ -0,0 +1,1099 @@ +#!/usr/bin/perl +# +# AST_update.pl version 1.1.9 (build 60117-1202) +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update the live_channels +# tables and verify the parked_channels table in the asterisk MySQL database +# This "near-live-status of Zap/SIP/Local/IAX channels" list is used by clients +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with Digium +# Zaptel telco cards and SIP VOIP hardphones or softphones as extensions, it +# could be adapted to other functions, but I designed it specifically for +# Zap/IAX2/SIP users. The program will run on UNIX or Win32 command line +# providing the following criteria are met: +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# Both - Net::MySQL, Net::Telnet and Time::HiRes perl modules loaded +# +# For the client program to work, this program must always be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the MySQL_AST_CREATE_tables.sql file, +# also make sure that the machine running this program has select/insert/update/delete +# access to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# version changes: +# 41228-1659 - modified to compensate for manager output response hiccups +# 50107-1611 - modified to add Zap and IAX2 clients (differentiate from trunks) +# 50117-1537 - modified to add MySQL port ($DB_port) var from conf file +# 50303-0958 - modified to compensate for Zap manager output hiccups +# 50406-1320 - added channel_data to live_channels table for more flexibility +# also added Zap/IAX client check every 100 loop instead of only once +# 50509-1047 - added collection of server_performance data with SYSPERF flag +# 50621-1307 - modified to allow for SIP trunks +# 50810-1601 - Added database server variable definitions lookup +# 50823-1625 - Altered Debug vars and initial CVS/1.2 support for changed output +# 50824-1606 - Altered CVS/1.2 support for "show channels concise" output +# 50829-1134 - Added processor percentage usage to stat collection +# 51229-1355 - Added ability to take ! as delimited for 1.2 show channels concise +# 60117-1202 - Changed IAX2 client phone channel to reflect change to '-' iteration +# + +$build = '60117-1202'; + +# constants +$SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds +$SYSPERF_rec=0; # is dial-time recording turned on +$DB=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! +$DBX=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! +$US='__'; +$AMP='@'; +$MT[0]=''; +$cpuUSERprev=0; +$cpuSYSTprev=0; +$cpuIDLEprev=0; + +# DB table variables for testing + $parked_channels = 'parked_channels'; + $live_channels = 'live_channels'; + $live_sip_channels = 'live_sip_channels'; + $server_updater = 'server_updater'; +# $parked_channels = 'TEST_parked_channels'; +# $live_channels = 'TEST_live_channels'; +# $live_sip_channels = 'TEST_live_sip_channels'; +# $server_updater = 'TEST_server_updater'; + +### 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 [-t] = test\n [-sysperf] = system performance logging\n [-sysperfdebug] = system performance debug output\n [-debug] = verbose debug messages\n [-debugX] = Extra-verbose debug messages\n\n"; + exit; + } + else + { + if ($args =~ /-sysperf/i) + { + $SYSPERF=1; # System performance logging flag + } + if ($args =~ /-sysperfdebug/i) + { + $SYSPERFDB=1; # prints system performance data out to STDOUT + } + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\nBUILD: $build\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + + &get_time_now; + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; + +use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; +use Net::Telnet (); + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,asterisk_version FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + $DBasterisk_version = "$record->[11]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + } + } + + if ($AST_ver =~ /^1\.2|^CVS|^SVN/i) {$show_channels_12_format = 1;} + else {$show_channels_12_format = 0;} + +##### LOOK FOR ZAP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR Zap clients assigned to this server:\n"; + $Zap_client_count=0; + $Zap_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'Zap' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $Zap_client_list .= "$record->[0]|"; + $Zap_client_count++; + } + } + +##### LOOK FOR IAX2 CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR IAX2 clients assigned to this server:\n"; + $IAX2_client_count=0; + $IAX2_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'IAX2' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $IAX2_client_list .= "$record->[0]|"; + if ($record->[0] !~ /\@/) + {$IAX2_client_list .= "$record->[0]$AMP$record->[0]|";} + else + { + $IAX_user = $record->[0]; + $IAX_user =~ s/\@.*$//gi; + $IAX2_client_list .= "$IAX_user|"; + } + $IAX2_client_count++; + } + } + +##### LOOK FOR SIP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR SIP clients assigned to this server:\n"; + $SIP_client_count=0; + $SIP_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'SIP' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $SIP_client_list .= "$record->[0]|"; + if ($record->[0] !~ /\@/) + {$SIP_client_list .= "$record->[0]$AMP$record->[0]|";} + else + { + $SIP_user = $record->[0]; + $SIP_user =~ s/\@.*$//gi; + $SIP_client_list .= "$SIP_user|"; + } + $SIP_client_count++; + } + } + + print STDERR "Zap Clients: $Zap_client_list\n"; + print STDERR "IAX2 Clients: $IAX2_client_list\n"; + print STDERR "SIP Clients: $SIP_client_list\n"; + +$one_day_interval = 12; # 2 hour loops for one day +while($one_day_interval > 0) +{ + + $event_string="STARTING NEW MANAGER TELNET CONNECTION||ATTEMPT|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + +if (!$telnet_port) {$telnet_port = '5038';} + + ### connect to asterisk manager through telnet + $t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); + #$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEupdate) > 3) {$telnet_login = $ASTmgrUSERNAMEupdate;} + else {$telnet_login = $ASTmgrUSERNAME;} + $t->open("$telnet_host"); + $t->waitfor('/0\n$/'); # print login + $t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $event_string="STARTING NEW MANAGER TELNET CONNECTION|$telnet_login|CONFIRMED CONNECTION|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + $endless_loop=5769999; # 30 days minutes at .45 seconds per loop + + while($endless_loop > 0) + { + + + @DBchannels=@MT; + @DBsips=@MT; + @list_channels=@MT; + @test_channels=@MT; + + &get_current_channels; + + &validate_parked_channels; + + + $t->buffer_empty; + if (!$show_channels_12_format) + { + @list_channels = $t->cmd(String => "Action: Command\nCommand: show channels\n\n", Prompt => '/--END COMMAND-.*/'); + } + else + { + @list_channels = $t->cmd(String => "Action: Command\nCommand: show channels concise\n\n", Prompt => '/--END COMMAND-.*/'); + } + + ##### TEST CHANNELS ZAP/IAX2/Local TO SEE IF THERE WAS A LARGE HICCUP IN OUTPUT FROM PREVIOUS OUTPUT + @test_channels=@list_channels; + $test_zap_count=0; + $test_iax_count=0; + $test_local_count=0; + $test_sip_count=0; + $s=0; + foreach(@test_channels) + { + chomp($test_channels[$s]); + if($DBX){print "$s|$test_channels[$s]\n";} + $test_channels[$s] =~ s/Congestion\s+\(Empty\)/ SIP\/CONGEST/gi; + $test_channels[$s] =~ s/\(Outgoing Line\)|\(None\)/SIP\/ring/gi; + $test_channels[$s] =~ s/\(Empty\)/SIP\/internal/gi; + if (!$show_channels_12_format) + { + $test_channels[$s] =~ s/^\s*|\s*$//gi; + $test_channels[$s] =~ s/\(.*\)//gi; + } + else + { + @test_chan_12 = split(/:/, $test_channels[$s]); + if (length($test_chan_12[6])<2) {$test_chan_12[6] = 'SIP/ring';} + $test_channels[$s] = "$test_chan_12[0] $test_chan_12[6]"; + } + if ($test_channels[$s] =~ /^Zap|^IAX2|^SIP|^Local/) + { + if ($test_channels[$s] =~ /^(\S+)\s+.+\s+(\S+)$/) + { + $channel = $1; + $extension = $2; + if ($show_channels_12_format) + {$extension =~ s/^.*\(|\).*$//gi;} + $extension =~ s/^SIP\/|-\S+$//gi; + $extension =~ s/\|.*//gi; + if ($channel =~ /^SIP/) {$test_sip_count++;} + if ($channel =~ /^Local/) {$test_local_count++;} + if ($IAX2_client_count) + { + $channel_match=$channel; + $channel_match =~ s/\/\d+$|-\d+$//gi; + $channel_match =~ s/^IAX2\///gi; + if ($IAX2_client_list =~ /\|$channel_match\|/i) {$test_iax_count++;} + } + if ($Zap_client_count) + { + $channel_match=$channel; + $channel_match =~ s/^Zap\///gi; + if ($Zap_client_list =~ /\|$channel_match\|/i) {$test_zap_count++;} + } + } + } + $s++; + } + + + + # $DB_live_lines = ($#DBchannels + $#DBsips); + $DB_live_lines = ($channel_counter + $sip_counter); + if ( (!$DB_live_lines) or ($#list_channels < 2) ) + {$PERCENT_static = 0;} + else + { + $PERCENT_static = ( ($#list_channels / $DB_live_lines) * 100); + $PERCENT_static = sprintf("%6.2f", $PERCENT_static); + } + + if ( (!$test_zap_count) or ($zap_client_counter < 2) ) + {$PERCENT_ZC_static = 0;} + else + { + $PERCENT_ZC_static = ( ($test_zap_count / $zap_client_counter) * 100); + $PERCENT_ZC_static = sprintf("%6.2f", $PERCENT_ZC_static); + } + + if ( (!$test_iax_count) or ($iax_client_counter < 2) ) + {$PERCENT_IC_static = 0;} + else + { + $PERCENT_IC_static = ( ($test_iax_count / $iax_client_counter) * 100); + $PERCENT_IC_static = sprintf("%6.2f", $PERCENT_IC_static); + } + + if ( (!$test_local_count) or ($local_client_counter < 2) ) + {$PERCENT_LC_static = 0;} + else + { + $PERCENT_LC_static = ( ($test_local_count / $local_client_counter) * 100); + $PERCENT_LC_static = sprintf("%6.2f", $PERCENT_LC_static); + } + + if ( (!$test_sip_count) or ($sip_client_counter < 2) ) + {$PERCENT_SC_static = 0;} + else + { + $PERCENT_SC_static = ( ($test_sip_count / $sip_client_counter) * 100); + $PERCENT_SC_static = sprintf("%6.2f", $PERCENT_SC_static); + } + + if ($endless_loop =~ /0$/) + {print "-$now_date $PERCENT_static $#list_channels $#DBchannels:$channel_counter $#DBsips:$sip_counter $PERCENT_ZC_static|$test_zap_count:$zap_client_counter $PERCENT_IC_static|$test_iax_count:$iax_client_counter $PERCENT_LC_static|$test_local_count:$local_client_counter $PERCENT_SC_static|$test_sip_count:$sip_client_counter\n";} + + if ( ( ($PERCENT_static < 10) && ( ($channel_counter > 3) or ($sip_counter > 4) ) ) or + ( ($PERCENT_static < 20) && ( ($channel_counter > 10) or ($sip_counter > 10) ) ) or + ( ($PERCENT_static < 30) && ( ($channel_counter > 20) or ($sip_counter > 20) ) ) or + ( ($PERCENT_static < 40) && ( ($channel_counter > 30) or ($sip_counter > 30) ) ) or + ( ($PERCENT_static < 50) && ( ($channel_counter > 40) or ($sip_counter > 40) ) ) or + ( ($PERCENT_ZC_static < 20) && ( $zap_client_counter > 3 ) ) or + ( ($PERCENT_ZC_static < 40) && ( $zap_client_counter > 9 ) ) or + ( ($PERCENT_IC_static < 20) && ( $iax_client_counter > 3 ) ) or + ( ($PERCENT_IC_static < 40) && ( $iax_client_counter > 9 ) ) or + ( ($PERCENT_SC_static < 20) && ( $sip_client_counter > 3 ) ) or + ( ($PERCENT_SC_static < 40) && ( $sip_client_counter > 9 ) ) ) + { + $UD_bad_grab++; + $event_string="------ UPDATER BAD GRAB!!! UBGcount: $UD_bad_grab\n $PERCENT_static $#list_channels $#DBchannels:$channel_counter $#DBsips:$sip_counter $PERCENT_ZC_static|$test_zap_count:$zap_client_counter $PERCENT_IC_static|$test_iax_count:$iax_client_counter $PERCENT_LC_static|$test_local_count:$local_client_counter $PERCENT_SC_static|$test_sip_count:$sip_client_counter\n"; + print "$event_string\n"; + &event_logger; + if ($UD_bad_grab > 20) {$UD_bad_grab=0;} + } + else + { + $UD_bad_grab=0; + if ( ($endless_loop =~ /0$/) && ($SYSPERF) ) + { + $cpuUSERcent=0; $cpuSYSTcent=0; $cpuIDLEcent=0; + ### get processor usage seconds ### + # cpu 924841 211725 270473 6961811 + @cpuUSE = `/usr/bin/cat /proc/stat`; + if ($cpuUSE[0] =~ /cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) + { + $cpuUSER = ($1 + $2); + $cpuSYST = $3; + $cpuIDLE = $4; + $cpuUSERdiff = ($cpuUSER - $cpuUSERprev); + $cpuSYSTdiff = ($cpuSYST - $cpuSYSTprev); + $cpuIDLEdiff = ($cpuIDLE - $cpuIDLEprev); + $cpuIDLEdiffTOTAL = (($cpuUSERdiff + $cpuSYSTdiff) + $cpuIDLEdiff); + if ($cpuIDLEdiffTOTAL > 0) + { + $cpuUSERcent = sprintf("%.0f", (($cpuUSERdiff / $cpuIDLEdiffTOTAL) * 100)); + $cpuSYSTcent = sprintf("%.0f", (($cpuSYSTdiff / $cpuIDLEdiffTOTAL) * 100)); + $cpuIDLEcent = sprintf("%.0f", (($cpuIDLEdiff / $cpuIDLEdiffTOTAL) * 100)); + } + $cpuUSERprev=$cpuUSER; + $cpuSYSTprev=$cpuSYST; + $cpuIDLEprev=$cpuIDLE; + } + + ### get system load ### + $serverLOAD = `/usr/bin/cat /proc/loadavg`; + $serverLOAD =~ s/ .*//gi; + $serverLOAD =~ s/\D//gi; + + ### get memory usage ### + @GRABserverMEMORY = `/usr/bin/free -m -t`; + if ($GRABserverMEMORY[1] =~ /Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+/) + { + $MEMused = $2; + $MEMfree = $3; + } + ### get number of system processes ### + @GRABserverPROCESSES = `/bin/ps -A --no-heading`; + $serverPROCESSES = $#GRABserverPROCESSES; + + if ($SYSPERF_rec) {$recording_count = ($test_local_count / 2)} + else {$recording_count=0;} + + if ($SYSPERFDB) + {print "$serverLOAD $MEMfree $MEMused $serverPROCESSES $#list_channels $cpuUSERcent $cpuSYSTcent $cpuIDLEcent\n";} + + $stmtA = "INSERT INTO server_performance (start_time,server_ip,sysload,freeram,usedram,processes,channels_total,trunks_total,clients_total,clients_zap,clients_iax,clients_local,clients_sip,live_recordings,cpu_user_percent,cpu_system_percent,cpu_idle_percent) values('$now_date','$server_ip','$serverLOAD','$MEMfree','$MEMused','$serverPROCESSES','$#list_channels','$channel_counter','$sip_counter','$test_zap_count','$test_iax_count','$test_local_count','$test_sip_count','$recording_count','$cpuUSERcent','$cpuSYSTcent','$cpuIDLEcent')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + + if ($endless_loop =~ /00$/) + { + ##### LOOK FOR ZAP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR Zap clients assigned to this server:\n"; + $Zap_client_count=0; + $Zap_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'Zap' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $Zap_client_list .= "$record->[0]|"; + $Zap_client_count++; + } + } + + ##### LOOK FOR IAX2 CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR IAX2 clients assigned to this server:\n"; + $IAX2_client_count=0; + $IAX2_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'IAX2' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $IAX2_client_list .= "$record->[0]|"; + if ($record->[0] !~ /\@/) + {$IAX2_client_list .= "$record->[0]$AMP$record->[0]|";} + else + { + $IAX_user = $record->[0]; + $IAX_user =~ s/\@.*$//gi; + $IAX2_client_list .= "$IAX_user|"; + } + $IAX2_client_count++; + } + } + + ##### LOOK FOR SIP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR SIP clients assigned to this server:\n"; + $SIP_client_count=0; + $SIP_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'SIP' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + print STDERR $record->[0],"\n"; + $SIP_client_list .= "$record->[0]|"; + if ($record->[0] !~ /\@/) + {$SIP_client_list .= "$record->[0]$AMP$record->[0]|";} + else + { + $SIP_user = $record->[0]; + $SIP_user =~ s/\@.*$//gi; + $SIP_client_list .= "$SIP_user|"; + } + $SIP_client_count++; + } + } + + + print STDERR "Zap Clients: $Zap_client_list\n"; + print STDERR "IAX2 Clients: $IAX2_client_list\n"; + print STDERR "SIP Clients: $SIP_client_list\n"; + } + + @list_chan_12=@MT; + $EXcount = 0; + $EXcount = @{[$list_channels[2] =~ /\!/g]}; + if ($EXcount > 10) + { + @list_chan_12 = split(/\!/, $list_channels[2]); + } + else + { + @list_chan_12 = split(/:/, $list_channels[2]); + } + if( ($DB) && ($show_channels_12_format) ) {print "concise: $#list_chan_12\n";} + if ( ( ( ($list_channels[1] =~ /State Appl\./) or ($list_channels[2] =~ /State Appl\.|Application\(Data\)/) or ($list_channels[3] =~ /State Appl\.|Application\(Data\)/) ) || ($#list_chan_12 > 8) ) && (!$UD_bad_grab) ) + { + + $c=0; + if($DB){print "lines: $#list_channels\n";} + if($DB){print "DBchn: $#DBchannels\n";} + if($DB){print "DBsip: $#DBsips\n";} + foreach(@list_channels) + { + # $DBchannels =~ s/^\|//g; + + chomp($list_channels[$c]); + if( ($DB) or ($UD_bad_grab) ){print "-|$c|$list_channels[$c]|\n";} + $list_channels[$c] =~ s/Congestion\s+\(Empty\)/ SIP\/CONGEST/gi; + $list_channels[$c] =~ s/\(Outgoing Line\)|\(None\)/SIP\/ring/gi; + $list_channels[$c] =~ s/\(Empty\)/SIP\/internal/gi; + if (!$show_channels_12_format) + { + $list_channels[$c] =~ s/^\s*|\s*$//gi; + $list_channels[$c] =~ s/\(.*\)//gi; + } + else + { + @list_chan_12=@MT; + if ($EXcount > 10) + { + @list_chan_12 = split(/\!/, $list_channels[$c]); + } + else + { + @list_chan_12 = split(/:/, $list_channels[$c]); + } + if ($DBX) {print "EXcount: $EXcount\n";} + if (length($list_chan_12[6])<2) {$list_chan_12[6] = 'SIP/ring';} + $list_channels[$c] = "$list_chan_12[0] $list_chan_12[6]"; + } + $list_SIP[$c] = $list_channels[$c]; + if( ($DB) or ($UD_bad_grab) ){print "+|$c|$list_channels[$c]|\n\n";} + + ########## PARSE EACH LINE TO DETERMINE WHETHER IT IS TRUNK OR CLIENT AND PUT IN APPROPRIATE TABLE + if ($list_channels[$c] =~ /^Zap|^IAX2|^SIP|^Local/) + { + if ($list_channels[$c] =~ /^(\S+)\s+.+\s+(\S+)$/) + { + $line_type = ''; + $channel = $1; + $extension = $2; + $channel_data = $extension; + if ($show_channels_12_format) + { + $extension =~ s/^.*\(|\).*$//gi; + #### new data in 1.2 for future use + # SIP/cc160-7b91:default:917274514920:3:Up:Dial:Zap/g2/17274514920|30|o:cc160::3:9:Zap/25-1 + # Zap/30-1:demo:010*010*010*012*8600091:1:Up:Dial:IAX2/TESTast2:test@10.10.10.12:4569/8600051|25|o:::3:123:IAX2/TESTast2-29 + # Zap/9-1:demo:990009*CL_UMGCOF_L**6317906**9545541833*13678*:2:Up:Dial:Zap/r3/90009*CL_UMGCOF_L**6317906**9545541833*13678*|120|o:::3:334:Zap/82-1 + # $channel = $list_chan_12[0]; + # $channel_data = $list_chan_12[0]; + # $context = $list_chan_12[1]; + # $dialed = $list_chan_12[2]; + # $priority = $list_chan_12[3]; + # $state = $list_chan_12[4]; + # $extension = $list_chan_12[6]; + # $callerid = $list_chan_12[7]; + # $duration = $list_chan_12[10]; + # $bridged = $list_chan_12[11]; + } + $extension =~ s/^SIP\/|-\S+$//gi; + $extension =~ s/\|.*//gi; + $QRYchannel = "$channel$US$extension"; + + if( ($DB) or ($UD_bad_grab) ){print "channel: |$channel|\n";} + if( ($DB) or ($UD_bad_grab) ){print "extension: |$extension|\n";} + if( ($DB) or ($UD_bad_grab) ){print "QRYchannel:|$QRYchannel|\n";} + + if ($channel =~ /^SIP|^Zap|^IAX2/) {$line_type = 'TRUNK';} + if ($channel =~ /^Local/) {$line_type = 'CLIENT';} + if ($IAX2_client_count) + { + $channel_match=$channel; + $channel_match =~ s/\/\d+$|-\d+$//gi; + $channel_match =~ s/^IAX2\///gi; + # print "checking for IAX2 client: |$channel_match|\n"; + if ($IAX2_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + if ($Zap_client_count) + { + $channel_match=$channel; + $channel_match =~ s/^Zap\///gi; + # print "checking for Zap client: |$channel_match|\n"; + if ($Zap_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + if ($SIP_client_count) + { + $channel_match=$channel; + $channel_match =~ s/-\S+$//gi; + $channel_match =~ s/^SIP\///gi; + # print "checking for SIP client: |$channel_match|\n"; + if ($SIP_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + + if ($line_type eq 'TRUNK') + { + if( ($DB) or ($UD_bad_grab) ){print "current channels: $#DBchannels\n";} + + $k=0; + $channel_in_DB=0; + foreach(@DBchannels) + { + if ( ($DBchannels[$k] eq "$QRYchannel") && (!$channel_in_DB) ) + { + $DBchannels[$k] = ''; + $channel_in_DB++; + } + if( ($DB) or ($UD_bad_grab) ){print "DB $k|$DBchannels[$k]| |";} + $k++; + } + + if ( (!$channel_in_DB) && (length($QRYchannel)>3) ) + { + $stmtA = "INSERT INTO $live_channels (channel,server_ip,extension,channel_data) values('$channel','$server_ip','$extension','$channel_data')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + + if ($line_type eq 'CLIENT') + { + if( ($DB) or ($UD_bad_grab) ){print "current sips: $#DBsips\n";} + + $k=0; + $sipchan_in_DB=0; + foreach(@DBsips) + { + if ( ($DBsips[$k] eq "$QRYchannel") && (!$sipchan_in_DB) ) + { + $DBsips[$k] = ''; + $sipchan_in_DB++; + } + if( ($DB) or ($UD_bad_grab) ){print "DB $k|$DBsips[$k]| |";} + $k++; + } + + if ( (!$sipchan_in_DB) && (length($QRYchannel)>3) ) + { + $stmtA = "INSERT INTO $live_sip_channels (channel,server_ip,extension,channel_data) values('$channel','$server_ip','$extension','$channel_data')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + } + } + + $c++; + } + if($DB){print "COUNT: $c|$#list_channels|$endless_loop\n";} + + + if ($#DBchannels >= 0) + { + $d=0; + foreach(@DBchannels) + { + if (length($DBchannels[$d])>4) + { + ($DELchannel, $DELextension) = split(/\_\_/, $DBchannels[$d]); + $stmtB = "DELETE FROM $live_channels where server_ip='$server_ip' and channel='$DELchannel' and extension='$DELextension' limit 1"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $dbhA->query($stmtB); + # $dbhA->query($stmtB) or die "Couldn't execute query:\n"; + } + $d++; + } + } + + if ($#DBsips >= 0) + { + $d=0; + foreach(@DBsips) + { + if (length($DBsips[$d])>4) + { + ($DELchannel, $DELextension) = split(/\_\_/, $DBsips[$d]); + $stmtB = "DELETE FROM $live_sip_channels where server_ip='$server_ip' and channel='$DELchannel' and extension='$DELextension' limit 1"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $dbhA->query($stmtB); + # $dbhA->query($stmtB) or die "Couldn't execute query:\n"; + } + $d++; + } + } + + ### sleep for 45 hundredths of a second + usleep(1*450*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "update.kill" in a directory will automatically safely kill this program + if (-e '/home/cron/update.kill') + { + unlink('/home/cron/update.kill'); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + + $bad_grabber_counter=0; + $no_channels_12_counter=0; + } + + else + { + if ( ($list_channels[1] !~ /Privilege: Command/) && ($show_channels_12_format) ) + { + $bad_grabber_counter++; + if($DB){print STDERR "\nbad grab, trying again\n";} + ### sleep for 20 hundredths of a second + usleep(1*200*1000); + + $event_string="BAD GRAB TRYING AGAIN|BAD_GRABS: $bad_grabber_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + if ($bad_grabber_counter > 100) + { + $endless_loop=0; + $event_string="TOO MANY BAD GRABS, STARTING NEW CONNECTION|BAD_GRABS: $bad_grabber_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + $bad_grabber_counter=0; + } + } + else + { + $no_channels_12_counter++; + $event_string="NO CHANNELS HERE|COUNTER: $no_channels_12_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|$list_channels[1]"; + &event_logger; + + if($DBX) {print "*|EMPTY CHANNELS: $no_channels_12_counter|$#list_channels|$list_channels[1]";} + + ### sleep for 40 hundredths of a second + usleep(1*400*1000); + if ($no_channels_12_counter == 3) + { + ### there are no channels, delete all from live_channels, live_sip_channels + $event_string="NO CHANNELS HERE|COUNTER: $no_channels_12_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|$list_channels[1]"; + &event_logger; + $stmtB = "DELETE FROM $live_sip_channels where server_ip='$server_ip'"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $dbhA->query($stmtB); + $stmtB = "DELETE FROM $live_channels where server_ip='$server_ip'"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $dbhA->query($stmtB); + } + + } + } + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + @hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); + + $ok = $t->close; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->close; + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + +####################################################################### +# This subroutine simply grabs all active channel/extension combinations from +# the asterisk MySQL database to be compared to the Asterisk Manager results +####################################################################### +sub get_current_channels +{ +$channel_counter=0; +$sip_counter=0; +$zap_client_counter=0; +$iax_client_counter=0; +$local_client_counter=0; +$sip_client_counter=0; + + if($DB){print STDERR "\n|SELECT channel,extension FROM $live_channels where server_ip = '$server_ip'|\n";} + +$dbhA->query("SELECT channel,extension FROM $live_channels where server_ip = '$server_ip'"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"|", $record->[1],"\n";} + $DBchannels[$channel_counter] = "$record->[0]$US$record->[1]"; + + $channel_counter++; + $rec_count++; + } + } + +$dbhA->query("SELECT channel,extension FROM $live_sip_channels where server_ip = '$server_ip'"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count_sip=0; + while ( $record = $iter->each) + { + if($DB){print STDERR $record->[0],"|", $record->[1],"\n";} + $DBsips[$sip_counter] = "$record->[0]$US$record->[1]"; + + if ($record->[0] =~ /^Zap/) {$zap_client_counter++;} + if ($record->[0] =~ /^IAX/) {$iax_client_counter++;} + if ($record->[0] =~ /^Local/) {$local_client_counter++;} + if ($record->[0] =~ /^SIP/) {$sip_client_counter++;} + $sip_counter++; + $rec_count_sip++; + } + } + + &get_time_now; + +$stmtU = "UPDATE $server_updater set last_update='$now_date' where server_ip='$server_ip'"; + if($DB){print STDERR "\n|$stmtU|\n";} +$dbhA->query($stmtU); + +} + + + + + +####################################################################### +# The purpose of this subroutine is to make sure that the calls that are +# listed as parked in the parked_channels table are in fact live (to make +# sure the caller has not hung up) and if the channel is not live to delete +# the parked_channels entry for that specific parked channel entry +# +# Yes it does use two DB connections all by itself, I just did that for speed +# and ease of programming to be backward compatible with MySQL < 4.1 or else +# I would have used a delete with subselect and saved all of this bloated code +####################################################################### +sub validate_parked_channels +{ + +if (!$run_validate_parked_channels_now) + { + + $parked_counter=0; + @ARchannel=@MT; @ARextension=@MT; @ARparked_time=@MT; @ARparked_time_UNIX=@MT; + $dbhA->query("SELECT channel,extension,parked_time,UNIX_TIMESTAMP(parked_time) FROM $parked_channels where server_ip = '$server_ip' order by channel desc, parked_time desc"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + $PQchannel = $record->[0]; + $PQextension = $record->[1]; + $PQparked_time = $record->[2]; + $PQparked_time_UNIX = $record->[3]; + if($DB){print STDERR "\n|$PQchannel|$PQextension|$PQparked_time|$PQparked_time_UNIX|\n";} + + my $dbhC = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + $AR=0; + $record_deleted=0; + foreach(@ARchannel) + { + if (@ARchannel[$AR] eq "$PQchannel") + { + if (@ARparked_time_UNIX[$AR] > $PQparked_time_UNIX) + { + if($DBX){print "Duplicate parked channel delete: |$PQchannel|$PQparked_time|\n";} + $stmtPQ = "DELETE FROM $parked_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension' and parked_time='$PQparked_time' limit 1"; + if($DB){print STDERR "\n|$stmtPQ|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n\n";} + $dbhC->query($stmtPQ); + + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter=0; + $record_deleted++; + } + + } + + $AR++; + } + + + + if (!$record_deleted) + { + $ARchannel[$rec_count] = $record->[0]; + $ARextension[$rec_count] = $record->[1]; + $ARparked_time[$rec_count] = $record->[2]; + $ARparked_time_UNIX[$rec_count] = $record->[3]; + + + my $dbhB = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + $event_string='LOGGED INTO MYSQL SERVER ON 2 CONNECTIONS TO VALIDATE PARKED CALLS|'; + &event_logger; + + + $dbhB->query("SELECT count(*) FROM $live_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension'"); + if ($dbhB->has_selected_record) + { + $iterB=$dbhB->create_record_iterator; + $rec_countB=0; + while ( $recordB = $iterB->each) + { + $PQcount = $recordB->[0]; + if($DB){print STDERR "\n|$PQcount|\n";} + + if ($PQcount < 1) + { + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter++; + if($DBX){print STDERR "Parked counter down|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n";} + + ### if the parked channel doesn't exist 6 times then delete it from table + if ($$DEL_chan_park_counter > 5) + { + if($DBX){print " parked channel delete: |$PQchannel|$PQparked_time|\n";} + $stmtPQ = "DELETE FROM $parked_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension' limit 1"; + if($DB){print STDERR "\n|$stmtPQ|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n\n";} + $dbhC->query($stmtPQ); + + $ARchannel[$rec_count] = ''; + $ARextension[$rec_count] = ''; + $ARparked_time[$rec_count] = ''; + $ARparked_time_UNIX[$rec_count] = ''; + $$DEL_chan_park_counter=0; + } + } + else + { + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter=0; + } + } + } + + $event_string='CLOSING MYSQL CONNECTIONS OPENED TO VALIDATE PARKED CALLS|'; + &event_logger; + + + $dbhB->close; + + } + + $dbhC->close; + + } + $parked_counter++; + $rec_count++; + } + + $run_validate_parked_channels_now=5; # set to run every five times the subroutine runs + + } + + $run_validate_parked_channels_now--; + +} + + + + + +################################################################################ +##### get the current date and time and epoch for logging call lengths and datetimes +sub get_time_now +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +} + + + + + +################################################################################ +##### open the log file for writing ### +sub event_logger +{ +open(Lout, ">>$LOGfile") + || die "Can't open $LOGfile: $!\n"; +print Lout "$now_date|$event_string|\n"; +close(Lout); +$event_string=''; +} diff --git a/AST_vm_update.pl b/AST_vm_update.pl new file mode 100644 index 0000000..6125ad7 --- /dev/null +++ b/AST_vm_update.pl @@ -0,0 +1,202 @@ +#!/usr/bin/perl +# +# AST_vm_update.pl version 0.3 +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update the count of +# voicemail messages for each mailbox (in the phone table) in the voicemail +# table list is used by client apps for voicemail notification +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with voicemail +# +# For the client program to notify of new messaged, this program must be in the +# cron running every minute +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute there is a theoretical limit of +# 600 mailboxes that it can check due to the wait interval. If you have +# more than this either change the cron when this script is run or change the +# wait interval below +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50823-1422 - Added database server variable definitions lookup +# 50823-1452 - Added commandline arguments for debug at runtime +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages per minute +$US='__'; +$MT[0]=''; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::MySQL; +use Net::Telnet (); + + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBtelnet_host = "$record->[0]"; + $DBtelnet_port = "$record->[1]"; + $DBASTmgrUSERNAME = "$record->[2]"; + $DBASTmgrSECRET = "$record->[3]"; + $DBASTmgrUSERNAMEupdate = "$record->[4]"; + $DBASTmgrUSERNAMElisten = "$record->[5]"; + $DBASTmgrUSERNAMEsend = "$record->[6]"; + $DBmax_vicidial_trunks = "$record->[7]"; + $DBanswer_transfer_agent= "$record->[8]"; + $DBSERVER_GMT = "$record->[9]"; + $DBext_context = "$record->[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + +@PTextensions=@MT; @PTvoicemail_ids=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; +$dbhA->query("SELECT extension,voicemail_id,messages,old_messages from phones where server_ip='$server_ip'"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_count=0; + while ( $record = $iter->each) + { + $PTextensions[$rec_count] = "$record->[0]"; + $PTvoicemail_ids[$rec_count] = "$record->[1]"; + $PTmessages[$rec_count] = "$record->[2]"; + $PTold_messages[$rec_count] = "$record->[3]"; + $rec_count++; + } + } + + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => 5038, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + @list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/'); + + $j=0; + foreach(@list_channels) + { + if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/) + { + $NEW_messages[$i] = "$list_channels[$j+1]"; + $NEW_messages[$i] =~ s/NewMessages: |\n//gi; + $OLD_messages[$i] = "$list_channels[$j+2]"; + $OLD_messages[$i] =~ s/OldMessages: |\n//gi; + } + + $j++; + } + + if($DB){print "MailboxCount- $PTvoicemail_ids[$i] NEW:|$NEW_messages[$i]| OLD:|$OLD_messages[$i]| ";} + if ( ($NEW_messages[$i] eq $PTmessages[$i]) && ($OLD_messages[$i] eq $PTold_messages[$i]) ) + { + if($DB){print "MESSAGE COUNT UNCHANGED, DOING NOTHING FOR THIS MAILBOX\n";} + } + else + { + $stmtA = "UPDATE phones set messages='$NEW_messages[$i]', old_messages='$OLD_messages[$i]' where server_ip='$server_ip' and extension='$PTextensions[$i]'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA) or die "Couldn't execute query:|$stmtA|\n"; + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + +$dbhA->close; + +if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + +exit; + + + + diff --git a/DTMF_sounds/0.wav b/DTMF_sounds/0.wav new file mode 100644 index 0000000..db262db Binary files /dev/null and b/DTMF_sounds/0.wav differ diff --git a/DTMF_sounds/1.wav b/DTMF_sounds/1.wav new file mode 100644 index 0000000..94ec03e Binary files /dev/null and b/DTMF_sounds/1.wav differ diff --git a/DTMF_sounds/2.wav b/DTMF_sounds/2.wav new file mode 100644 index 0000000..abdf9b2 Binary files /dev/null and b/DTMF_sounds/2.wav differ diff --git a/DTMF_sounds/3.wav b/DTMF_sounds/3.wav new file mode 100644 index 0000000..e94977c Binary files /dev/null and b/DTMF_sounds/3.wav differ diff --git a/DTMF_sounds/4.wav b/DTMF_sounds/4.wav new file mode 100644 index 0000000..b20dcba Binary files /dev/null and b/DTMF_sounds/4.wav differ diff --git a/DTMF_sounds/5.wav b/DTMF_sounds/5.wav new file mode 100644 index 0000000..6d0ef37 Binary files /dev/null and b/DTMF_sounds/5.wav differ diff --git a/DTMF_sounds/6.wav b/DTMF_sounds/6.wav new file mode 100644 index 0000000..b67755a Binary files /dev/null and b/DTMF_sounds/6.wav differ diff --git a/DTMF_sounds/7.wav b/DTMF_sounds/7.wav new file mode 100644 index 0000000..0cc3acd Binary files /dev/null and b/DTMF_sounds/7.wav differ diff --git a/DTMF_sounds/8.wav b/DTMF_sounds/8.wav new file mode 100644 index 0000000..c83eab7 Binary files /dev/null and b/DTMF_sounds/8.wav differ diff --git a/DTMF_sounds/9.wav b/DTMF_sounds/9.wav new file mode 100644 index 0000000..b991053 Binary files /dev/null and b/DTMF_sounds/9.wav differ diff --git a/DTMF_sounds/US_pol_survey_hello.gsm b/DTMF_sounds/US_pol_survey_hello.gsm new file mode 100644 index 0000000..62e844e Binary files /dev/null and b/DTMF_sounds/US_pol_survey_hello.gsm differ diff --git a/DTMF_sounds/US_pol_survey_transfer.gsm b/DTMF_sounds/US_pol_survey_transfer.gsm new file mode 100644 index 0000000..897afab Binary files /dev/null and b/DTMF_sounds/US_pol_survey_transfer.gsm differ diff --git a/DTMF_sounds/US_reminder_callback.gsm b/DTMF_sounds/US_reminder_callback.gsm new file mode 100644 index 0000000..dfb73f5 Binary files /dev/null and b/DTMF_sounds/US_reminder_callback.gsm differ diff --git a/DTMF_sounds/US_reminder_goodbye.gsm b/DTMF_sounds/US_reminder_goodbye.gsm new file mode 100644 index 0000000..4759fdf Binary files /dev/null and b/DTMF_sounds/US_reminder_goodbye.gsm differ diff --git a/DTMF_sounds/US_reminder_message.gsm b/DTMF_sounds/US_reminder_message.gsm new file mode 100644 index 0000000..863cbab Binary files /dev/null and b/DTMF_sounds/US_reminder_message.gsm differ diff --git a/DTMF_sounds/US_reminder_options.gsm b/DTMF_sounds/US_reminder_options.gsm new file mode 100644 index 0000000..774fe35 Binary files /dev/null and b/DTMF_sounds/US_reminder_options.gsm differ diff --git a/DTMF_sounds/US_thanks_no_contact.gsm b/DTMF_sounds/US_thanks_no_contact.gsm new file mode 100644 index 0000000..c0e6a2b Binary files /dev/null and b/DTMF_sounds/US_thanks_no_contact.gsm differ diff --git a/DTMF_sounds/four_digit_id.gsm b/DTMF_sounds/four_digit_id.gsm new file mode 100644 index 0000000..5c60505 Binary files /dev/null and b/DTMF_sounds/four_digit_id.gsm differ diff --git a/DTMF_sounds/generic_hold.gsm b/DTMF_sounds/generic_hold.gsm new file mode 100644 index 0000000..c76eccd Binary files /dev/null and b/DTMF_sounds/generic_hold.gsm differ diff --git a/DTMF_sounds/hash.wav b/DTMF_sounds/hash.wav new file mode 100644 index 0000000..e5ea708 Binary files /dev/null and b/DTMF_sounds/hash.wav differ diff --git a/DTMF_sounds/hold_tone.gsm b/DTMF_sounds/hold_tone.gsm new file mode 100644 index 0000000..8f9686c Binary files /dev/null and b/DTMF_sounds/hold_tone.gsm differ diff --git a/DTMF_sounds/silence.wav b/DTMF_sounds/silence.wav new file mode 100644 index 0000000..6256570 Binary files /dev/null and b/DTMF_sounds/silence.wav differ diff --git a/DTMF_sounds/star.wav b/DTMF_sounds/star.wav new file mode 100644 index 0000000..529087d Binary files /dev/null and b/DTMF_sounds/star.wav differ diff --git a/LANG_admin.zip b/LANG_admin.zip new file mode 100644 index 0000000..4b38139 Binary files /dev/null and b/LANG_admin.zip differ diff --git a/LANG_admin/LANG_admin/astguiclient/AST_inboundEXTstats.php b/LANG_admin/LANG_admin/astguiclient/AST_inboundEXTstats.php new file mode 100644 index 0000000..db7d080 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/AST_inboundEXTstats.php @@ -0,0 +1,369 @@ + + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Inbound Calls Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Calls Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls That came into this number:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+echo "| CALLERID   | CALLERIDNAME    | LENGTH | DATE TIME           |\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-10s", $row[0]);
+	$CIDname =		sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+------------+-----------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient/admin.php b/LANG_admin/LANG_admin/astguiclient/admin.php new file mode 100644 index 0000000..adb0c29 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/admin.php @@ -0,0 +1,1627 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$STARTtime = date("U"); +$STARTdate = date("Y-m-d H:i:s"); + +if ($ADD==1) {$process = 'ADD NEW PHONE';} +if ($ADD==11) {$process = 'ADD NEW SERVER';} +if ($ADD==111) {$process = 'ADD NEW CONFERENCE';} +if ($ADD==2) {$process = 'ADDING NEW PHONE';} +if ($ADD==21) {$process = 'ADDING NEW SERVER';} +if ($ADD==211) {$process = 'ADDING NEW CONFERENCE';} +if ($ADD==3) {$process = 'MODIFY PHONE';} +if ($ADD==31) {$process = 'MODIFY SERVER';} +if ($ADD==311) {$process = 'MODIFY CONFERENCE';} +if ($ADD==4) {$process = 'MODIFYING PHONE';} +if ($ADD==41) {$process = 'MODIFYING SERVER';} +if ($ADD==411) {$process = 'MODIFYING CONFERENCE';} +if ($ADD==5) {$process = 'DELETE PHONE';} +if ($ADD==6) {$process = 'DELETE PHONE';} +if ($ADD==55) {$process = 'SEARCH PHONES';} +if ($ADD==66) {$process = 'SEARCH PHONES RESULTS';} +if ($ADD==0) {$process = 'PHONE LIST';} +if ($ADD==10) {$process = 'SERVER LIST';} +if ($ADD==100) {$process = 'CONFERENCE LIST';} +if ($ADD==99999) {$process = 'HELP';} + + $stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status='ADMIN';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if ($auth<1) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > '6' and ast_admin_access='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGdelete_phones =$row[17]; + } + } + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + echo "|$stmt|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + if (strlen($LOGfullname) < 1) + { + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); + +$NWB = "   \"HELP\""; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "ASTERISK ADMIN: Administration - $process \n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
ASTERISK ADMIN: HELP


\n"; + +?> +PHONES TABLE

+ +
+Phone extension - This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone. + +
+
+
+Dialplan number - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Box - This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app. + +
+
+
+Outbound CallerID - This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS, non-PRI, T1/E1s. + +
+
+
+Phone IP address - This field is for the phone's IP address if it is a VOIP phone. This is an optional field + +
+
+
+Computer IP address - This field is for the user's computer IP address. This is an optional field + +
+
+
+Server IP - This menu is where you select which server the phone is active on. + +
+
+
+Login - The login used for the phone user to get to admin functions. + +
+
+
+Password - The password used for the phone user to get to admin functions. + +
+
+
+Status - The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access. + +
+
+
+Active Account - Whether the phone is active to put it in the list in the GUI client. + +
+
+
+Phone Type - Purely for administrative notes. + +
+
+
+Full Name - Used by the GUIclient in the list of active phones. + +
+
+
+Company - Purely for administrative notes. + +
+
+
+Picture - Not yet Implemented. + +
+
+
+New Messages - Number of new voicemail messages for this phone on the Asterisk server. + +
+
+
+Old Messages - Number of old voicemail messages for this phone on the Asterisk server. + +
+
+
+Client Protocol - The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones. + +
+
+
+Local GMT - 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 VICIDIAL campaign to accurately display the time and customer time. + +
+
+
+Manager Login - This is the login that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+Manager Secret - This is the password that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+VICIDIAL Default User - This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user. + +
+
+
+VICIDIAL Default Pass - This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass. + +
+
+
+VICIDIAL Default Campaign - This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign. + +
+
+
+Park Exten - This is the default Parking extension for the client apps. Verify that a different one works before you change this. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park File - This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters. + +
+
+
+Monitor Prefix - This is the dialplan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Recording Exten - This is the dialplan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing. + +
+
+
+VMAIL Main Exten - This is the dialplan extension going to check your voicemail. verify with extensions.conf file before changing. + +
+
+
+VMAIL Dump Exten - This is the dialplan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing. + +
+
+
+Exten Context - This is the dialplan context that this phone 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. + +
+
+
+DTMF send Channel - This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file. + +
+
+
+Outbound Call Group - This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file, it is usually what you have defined as the TRUNK global variable at the top of the file. + +
+
+
+Browser Location - This is applicable to only UNIX/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually. + +
+
+
+Install Directory - This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like /usr/local/perl_TK. verify this manually. + +
+
+
+CallerID URL - This is the web address of the page used to do custom callerID lookups. default testing address is: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Default URL - This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Call Logging - This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hangup 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly. + +
+
+
+User Switching - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Set to true to allow user to start conference calls with upto six external lines. + +
+
+
+Admin Hangup - Set to true to allow user to be able to hangup any line at will through astGUIclient. Good idea only to enable this for Admin users. + +
+
+
+Admin Hijack - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers. + +
+
+
+Admin Monitor - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool. + +
+
+
+Call Park - Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hangup. Usually enabled for all. + +
+
+
+Updater Check - Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users. + +
+
+
+AF Logging - Set to true to log many actions of astGUIclient usage to a text file on the user's computer. + +
+
+
+Queue Enabled - Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users. + +
+
+
+CallerID Popup - Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users. + +
+
+
+VMail Button - Set to true to display the VOICEMAIL button and the messages count display on astGUIclient. + +
+
+
+Fast Refresh - Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Fast Refresh Rate - in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Persistant MySQL - If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine. + +
+
+
+Auto Dial Next Number - If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen. + +
+
+
+Stop Rec after each call - If enabled the VICIDIAL client 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. + +
+
+
+DBX Server - The MySQL database server that this user should be connecting to. + +
+
+
+DBX Database - The MySQL database that this user should be connecting to. Default is asterisk. + +
+
+
+DBX User - The MySQL user login that this user should be using when connecting. Default is cron. + +
+
+
+DBX Pass - The MySQL user password that this user should be using when connecting. Default is 1234. + +
+
+
+DBX Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. + +
+
+
+DBY Server - The MySQL database server that this user should be connecting to. Secondary server, not used currently. + +
+
+
+DBY Database - The MySQL database that this user should be connecting to. Default is asterisk. Secondary server, not used currently. + +
+
+
+DBY User - The MySQL user login that this user should be using when connecting. Default is cron. Secondary server, not used currently. + +
+
+
+DBY Pass - The MySQL user password that this user should be using when connecting. Default is 1234. Secondary server, not used currently. + +
+
+
+DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. + + +



+ +SERVERS TABLE

+
+
+Server ID - This field is where you put the Asterisk servers name, doesnt have to be an official domain sub, just a nickname to identify the server to Admin users. + +
+
+
+Server Description - The field where you use a small phrase to describe the Asterisk server. + +
+
+
+Server IP Address - The field where you put the Network IP address of the Asterisk server. + +
+
+
+Active - Set whether the Asterisk server is active or inactive. + +
+
+
+Asterisk Version - Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local/ channels, a bug that has been fixed in CVS v1.0, and need to be treated differently when handling their Local/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well. + +
+
+
+Max VICIDIAL Trunks - This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96. + +
+
+
+Telnet Host - This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine. + +
+
+
+Telnet Port - This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install. + +
+
+
+Manager User - The username or login used to connect genericly to the Asterisk server manager. Default is 'cron' + +
+
+
+Manager Secret - The secret or password used to connect genericly to the Asterisk server manager. Default is '1234' + +
+
+
+Manager Update User - The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user. + +
+
+
+Manager Listen User - The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user. + +
+
+
+Manager Send User - The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user. + +
+
+
+Server GMT offset - The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5' + +
+
+
+VMail Dump Exten - The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666' + +
+
+
+VICIDIAL AD extension - The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365' + +
+
+
+Default Context - The default dialplan context used for scripts that operate for this server. Default is 'default' + + +



+ +CONFERENCES TABLE

+
+
+Conference Number - This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL. + +
+
+
+Server IP - The menu where you select the Asterisk server that this conference will be on. + + + + + + +







+







+THE END +
+ + + +ASTERISK ADMIN: Administration - <? echo $process ?> + + + +
+ + + + + + +
  ASTERISK ADMIN - Logout  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
+"; + +echo "
ADD A NEW PHONE
\n"; +echo "\n"; +echo "
\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW SERVERS FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW SERVER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW CONFERENCES FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW CONFERENCE\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + +} + + +###################### +# ADD=2 adds the new phone to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new server to the system +###################### + +if ($ADD==21) +{ + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVER NOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER ADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new conference to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE ADDED\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=100; +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of phone +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGdelete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
PHONE DELETION CONFIRMATION: $extension - $server_ip\n"; + echo "

Click here to delete phone $extension - $server_ip


\n"; + } + +$ADD='3'; # go to phone modification below +} + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete phone record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGdelete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; + echo "

\n"; + } + +$ADD='0'; # go to phone list +} + + + + + + +###################### +# ADD=3 modify phone info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A PHONE RECORD: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hangup: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Click here for phone stats\n"; + +if ($LOGdelete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + +} + + +###################### +# ADD=31 modify server info in the system +###################### + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A SERVER RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
PHONES WITHIN THIS SERVER:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This server has $active_lists active phones and $inactive_lists inactive phones

\n"; +echo "
\n"; +} + + +###################### +# ADD=311 modify conference info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A CONFERENCE RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + +echo "
\n"; + +} + + + +###################### +# ADD=4 submit phone modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
PHONE NOT MODIFIED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='$local_web_callerID_URL', VICIDIAL_web_URL='$VICIDIAL_web_URL', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A PHONE RECORD: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hangup: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Click here for phone stats\n"; + +if ($LOGdelete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + +} + +###################### +# ADD=41 submit server modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER MODIFIED: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A SERVER RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
PHONES WITHIN THIS SERVER:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This server has $active_lists active phones and $inactive_lists inactive phones

\n"; +echo "
\n"; + +} + +###################### +# ADD=411 submit conference modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from conferences where conf_exten='$conf_exten';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A CONFERENCE RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + +echo "
\n"; + +} + + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
SEARCH FOR A PHONE\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
extension:
Full Name:
Phone type:
\n"; + +} + +###################### +# ADD=66 phone search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($extension) {$SQL .= "user LIKE \"%$extension%\" and";} + if ($fullname) {$SQL .= "fullname LIKE \"%$fullname%\" and";} + if ($phone_type) {$SQL .= "phone_type LIKE \"%$phone_type%\" and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from phones $SQL order by extension,server_ip;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; + +} + + + +###################### +# ADD=0 display all active phones +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from phones order by extension,server_ip"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; +} + +###################### +# ADD=10 display all servers +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SERVER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all conferences +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient/dbconnect.php b/LANG_admin/LANG_admin/astguiclient/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/astguiclient/help.gif b/LANG_admin/LANG_admin/astguiclient/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/astguiclient/help.gif differ diff --git a/LANG_admin/LANG_admin/astguiclient/htglobalize.php b/LANG_admin/LANG_admin/astguiclient/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient/inbound_popup.php b/LANG_admin/LANG_admin/astguiclient/inbound_popup.php new file mode 100644 index 0000000..90f2442 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/inbound_popup.php @@ -0,0 +1,194 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK REMOTE INBOUND: Popup + + +
+ + 0) +{ + + $stmt="DELETE from parked_channels where server_ip='$user_server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$user_server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + + $url = 'https://10.10.10.15/internal/back_end_systems/cust_serv/index.php?Search=SEARCH&'; + $Suser = 'username='; + $Spass = '&passwd='; + $Sphone = '&phone='; + + $newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW$Sphone$phone"; + if ( ($phone == 'unknown') or (strlen($phone)<9) ) + {$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW";} + + echo "Look up this customer in Customer Service System\n

\n"; + + echo "Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Close this window\n

\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient/phone_stats.php b/LANG_admin/LANG_admin/astguiclient/phone_stats.php new file mode 100644 index 0000000..8ca295c --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/phone_stats.php @@ -0,0 +1,228 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK ADMIN: Phone Stats + + +
+
+ + + + + + +\n"; +echo "
  ASTERISK ADMIN: Administration  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
  \n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "CALL TIME AND CHANNELS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
CHANNEL GROUP COUNT HOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LAST 1000 CALLS FOR DATE RANGE:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
NUMBER CHANNEL GROUP DATE LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient/remote_inbound.php b/LANG_admin/LANG_admin/astguiclient/remote_inbound.php new file mode 100644 index 0000000..92bab3c --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient/remote_inbound.php @@ -0,0 +1,165 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + echo"\n"; + echo"ASTERISK REMOTE INBOUND: Main\n"; + echo"\n"; + echo"\n"; + echo"\n"; + +?> + + +
+ +
\n"; + +echo "Click on the channel below that you would like to have directed to your phone

\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME        \n";
+echo "----------------------------------------------------------------------------------------------\n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' order by parked_time";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$user_server_ip' and channel_group LIKE \"IN_%\" order by parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$extension =		sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		echo "$channel$server$channel_group$extension$parked_by$parked_time\n";
+
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "*************************************** NO PARKED CALLS **************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_el/AST_inboundEXTstats.php b/LANG_admin/LANG_admin/astguiclient_el/AST_inboundEXTstats.php new file mode 100644 index 0000000..add6109 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/AST_inboundEXTstats.php @@ -0,0 +1,369 @@ + + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Στατιστικά ΕισεÏχομένων Κλησεων\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΕÎΑΠΑΡΙΘΜΟ ΚΑΙ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Στατιστικά ΕισεÏχομένων Κλησεων                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Συνολικές κλήσεις που ήÏθαν σε αυτό τον αÏιθμό:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+echo "| CALLERID   | CALLERIDNAME    | LENGTH | DATE TIME           |\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-10s", $row[0]);
+	$CIDname =		sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+------------+-----------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΟÎΟΥ\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩÎ\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_el/admin.php b/LANG_admin/LANG_admin/astguiclient_el/admin.php new file mode 100644 index 0000000..f29f194 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/admin.php @@ -0,0 +1,1627 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$STARTtime = date("U"); +$STARTdate = date("Y-m-d H:i:s"); + +if ($ADD==1) {$process = 'ΠΡΟΣΘΕΣΕ ÎΕΟ ΤΗΛΕΦΩÎΟ';} +if ($ADD==11) {$process = 'ΠΡΟΣΘΕΣΕ ÎΕΟ ΔΙΑΚΟΜΙΣΤΗ';} +if ($ADD==111) {$process = 'ΠΡΟΣΘΕΣΕ ÎΕΑ ΣΥÎΔΙΑΛΕΞΗ';} +if ($ADD==2) {$process = 'ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΤΗΛΕΦΩÎΟΥ';} +if ($ADD==21) {$process = 'ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΔΙΑΚΟΜΙΣΤΗ';} +if ($ADD==211) {$process = 'ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΣΥÎΔΙΑΛΕΞΗΣ';} +if ($ADD==3) {$process = 'ΤΡΟΠΟΠΟΙΗΣΕ ΤΗΛΕΦΩÎΟ';} +if ($ADD==31) {$process = 'ΤΡΟΠΟΠΟΙΗΣΕ ΔΙΑΚΟΜΙΣΤΗ';} +if ($ADD==311) {$process = 'ΤΡΟΠΟΠΟΙΗΣΕ ΣΥÎΔΙΑΛΕΞΗ';} +if ($ADD==4) {$process = 'ΤΡΟΠΟΠΟΙΗΣΗ ΤΗΛΕΦΩÎΟΥ';} +if ($ADD==41) {$process = 'ΤΡΟΠΟΠΟΙΗΣΗ ΔΙΑΚΟΜΙΣΤΗ';} +if ($ADD==411) {$process = 'ΤΡΟΠΟΠΟΙΗΣΗ ΣΥÎΔΙΑΛΕΞΗΣ';} +if ($ADD==5) {$process = 'DELETE PHONE';} +if ($ADD==6) {$process = 'DELETE PHONE';} +if ($ADD==55) {$process = 'ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΩÎ';} +if ($ADD==66) {$process = 'ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΩΠRESULTS';} +if ($ADD==0) {$process = 'ΛΙΣΤΑ ΤΗΛΕΦΩÎΟΥ';} +if ($ADD==10) {$process = 'ΛΙΣΤΑ ΔΙΑΚΟΜΙΣΤΗ';} +if ($ADD==100) {$process = 'ΛΙΣΤΑ ΣΥÎΔΙΑΛΕΞΕΩÎ';} +if ($ADD==99999) {$process = 'ΒΟΗΘΕΙΑ';} + + $stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status='ADMIN';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if ($auth<1) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > '6' and ast_admin_access='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGdelete_phones =$row[17]; + } + } + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + echo "|$stmt|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + if (strlen($LOGfullname) < 1) + { + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); + +$NWB = "   \"ΒΟΗΘΕΙΑ\""; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "ΔΙΑΧ ASTERISK: ΔιαχείÏιση - $process \n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
ASTERISK ADMIN: ΒΟΗΘΕΙΑ


\n"; + +?> +ΠΙÎΑΚΑΣ ΤΗΛΕΦΩÎΩÎ

+ +
+Εσωτ.ΣÏνδεση Τηλεφώνου - Αυτό το πεδίο είναι για την καταχώÏηση του ονόματος του τηλεφώνου, όπως αυτό εμφανίζεται στο Asterisk, χωÏίς να συμπεÏιλαμβάνει το Ï€Ïωτόκολλο ή slash στην αÏχή. Για παÏάδειγμα: για SIP τηλέφωνο SIPVtest101 η Εσωτ.ΓÏαμμή Τηλεφώνου θα είναι test101. Επίσης, για IAX2 τηλέφωνα χÏησιμοποιείστε τα πλήÏης ονόματα: IAX2/IAXphone1@IAXphone1 θα είναι IAXphone1@IAXphone1. Για Zap τηλέφωνα καταχωÏήστε το πλήÏες κανάλι: Zap/25-1 θα είναι 25-1. Αλλη σημείωση, οÏίστε το Ï€Ïωτόκολλο παÏακάτω σωστά για τον Ï„Ïπο του τηλεφώνου. + +
+
+
+ΑÏιθμός Σχεδίου Κλήσεων - Αυτό το πεδίο είναι για τον αÏιθμό που καλείται για να κουδουνίζει το τηλέφωνο. Αυτός ο αÏιθμός οÏίζεται στο αÏχείο extensions.conf του διακομιστή Asterisk + +
+
+
+ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου - Αυτό το πεδίο είναι για το πεÏιεχόμενο του Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου, όπου πηγαίνουν τα μηνÏματα του τηλεφώνου του χÏήστη. Το χÏησιμοποιοÏμαι για να ελέγξουμε τα φωνητικά μηνÏματα και για να μποÏεί ο χÏήστης να χÏησιμοποιήσει το πλήκτÏο VOICEMAIL. + +
+
+
+CallerID ΕξεÏχομένων - Αυτό το πεδίο είναι για την καταχώÏηση του αÏÎ¹Î¸Î¼Î¿Ï callerID που θα θέλατε να εμφανίζεται στις εξεÏχόμενες κλήσεις. + +
+
+
+Δνση IP Τηλεφώνου - Αυτό το πεδίο είναι για την δνση IP του τηλέφωνου εάν είναι ένα VOIP τηλέφωνο. Αυτό είναι ένα Ï€ÏοαιÏετικό πεδίο + +
+
+
+Δνση IP Î¥Ï€Î¿Î»Î¿Î³Î¹ÏƒÏ„Î¿Ï - Αυτό το πεδίο είναι για την δνση IP του υπολογιστή του χÏήστη. Αυτό είναι ένα Ï€ÏοαιÏετικό πεδίο + +
+
+
+IP Διακομιστή - Αυτός ο κατάλογος επιλογών είναι που επιλέγετε σε ποιον διακομιστή το τηλέφωνο είναι ενεÏγό. + +
+
+
+ΣÏνδεση - Η σÏνδεση χÏησιμοποιείται για τον χÏήστη τηλεφώνου για την Ï€Ïόσβαση στις λειτουÏγίες διαχείÏισης. + +
+
+
+Κωδκός - Ο κωδικός χÏησιμοποιείται για τον χÏήστη τηλεφώνου για την Ï€Ïόσβαση στις λειτουÏγίες διαχείÏισης. + +
+
+
+Κατάσταση - Η κατάσταση του τηλεφώνου στο σÏστημα, ΕÎΕΡΓΗ και ΔΙΑΧ επιτÏέπουν στους GUI πελάτες να δουλέψουν. Η ΔΙΑΧ επιτÏέπει την Ï€Ïόσβαση στην ιστοσελίδα διαχείÏισης. + +
+
+
+ΕνεÏγός ΛογαÏιασμός - Κατά πόσο το τηλέφωνο είναι ενεÏγό για να τοποθετηθεί στην λίστα στο GUI. + +
+
+
+ΤÏπος Τηλεφώνου - Απλά για σημειώσεις διαχείÏισης. + +
+
+
+ΠλήÏες Ονομα - ΧÏησιμοποιείται από τον χÏήστη GUI στην λίστα ενεÏγών τηλεφώνων. + +
+
+
+ΕταιÏία - Απλά για σημειώσεις διαχείÏισης. + +
+
+
+Εικόνα - Δεν έχει υλοποιηθεί ακόμα. + +
+
+
+Îέα ΜηνÏματα - ΑÏιθμός νέων φωνητικών μηνυμάτων για αυτό το τηλέφωνο στον διακομιστή Asterisk. + +
+
+
+Παλαιά ΜηνÏματα - ΑÏιθμός παλαιών φωνητικών μηνυμάτων για αυτό το τηλέφωνο στον διακομιστή Asterisk. + +
+
+
+ΠÏωτόκολλο Πελάτη - Το Ï€Ïωτόκολλο που χÏησιμοποιεί το τηλέφωνο για συνδεθεί στον διακομιστή Asterisk: SIP, IAX2, Zap.. + +
+
+
+Τοπική GMT - Η διαφοÏά από την GMT όπου το τηλέφωνο βÏίσκεται. Μην το Ïυθμίσετε για DAYLIGHT SAVINGS ΩΡΑ. Αυτή χÏησιμοποιείται από την VICIDIAL εκστÏατεία για την επακÏιβή εμφάνιση της ÏŽÏας. + +
+
+
+ΣÏνδεση ΔιαχειÏιστή - Αυτή είναι η σÏνδεση που χÏησιμοποιοÏν οι GUI χÏήστες του τηλεφώνου, για Ï€Ïόσβαση στην Βάση Δεδομένων όπου ο διακομιστής δεδομένων βÏίσκεται. + +
+
+
+Μυστικό ΔιαχειÏιστή - Αυτός είναι ο κωδικός που χÏησιμοποιοÏν οι GUI χÏήστες του τηλεφώνου, για Ï€Ïόσβαση στην Βάση Δεδομένων όπου ο διακομιστής δεδομένων βÏίσκεται. + +
+
+
+VICIDIAL ΠÏοκαθοÏισμένος ΧÏήστης - Εδώ οÏίζεται μία Ï€ÏοκαθοÏισμένη τιμή χÏήστη, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για κανένα χÏήστη. + +
+
+
+VICIDIAL ΠÏοκαθοÏισμένος Κωδικός - Εδώ οÏίζεται μία Ï€ÏοκαθοÏισμένη τιμή κωδικοÏ, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για κανένα κωδικό. + +
+
+
+VICIDIAL ΠÏοκαθοÏισμένη ΕκστÏατεία - Εδώ οÏίζεται μία Ï€ÏοκαθοÏισμένη τιμή εκστÏατείας, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για καμία εκστÏατεία. + +
+
+
+Εσ.ΣÏνδ. Στάθμευσης - Αυτή είναι η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση Στάθμευσης για τις εφαÏμογές του χÏήστη. + +
+
+
+Εσ.ΣÏνδ. Συνδιάλεξης - Αυτή είναι η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση Συνδιάλεξης για τις εφαÏμογές του χÏήστη. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+. + +
+
+
+ΕξεÏχόμενη ομάδα κλήσης - αυτό είναι η ομάδα καναλιών ότι οι εξεÏχόμενες κλήσεις από αυτό το τηλέφωνο τοποθετοÏνται από. ΥπάÏχουν Ïουτίνες ζευγών στον πελάτη apps ότι χÏήση αυτό. Για τα κανάλια Zap θέλετε να χÏησιμοποιήσετε κάτι σαν Zap/g2, για IAX2 τους κοÏμοÏÏ‚ που θα θέλατε να χÏησιμοποιήσετε το πλήÏες Ï€Ïόθεμα IAX όπως IAX2/VICItest1:secret@10.10.10.15:4569. ελέγξτε τους κοÏμοÏÏ‚ με το αÏχείο extensions.conf, είναι συνήθως τι έχετε οÏίσει ως ο ΚΟΡΜΌΣ τη σφαιÏική μεταβλητή στην κοÏυφή του αÏχείου. + +
+
+
+. + +
+
+
+. + +
+
+
+ + +
+
+
+VICIDIAL ΠÏοκαθοÏισμένο URL - Αυτή είναι η δη ιστοσελίδας που χÏησιμοποιείται για Ï€ÏοσαÏμοσμένα VICIDIAL εÏωτήματα ιστοσελίδας + +
+
+
+ΚαταγÏαφή Γεγονότων Κλήσης - Αυτό τοποθετείται σε αληθές εάν το αÏχείο call_log.agi βÏίσκεται στο αÏχείο extensions.conf για τις εξεÏχόμενες κλήσεις και για τις εσωτ.συνδέσεις 'h' που κλείνουν. Αυτό Ï€Ïέπει πάντα να είναι 1 για να δουλεÏουν σωστά πολλά χαÏακτηÏιστικά των εφαÏμογών. + +
+
+
+Μεταγωγή ΧÏήστη - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να μεταβοÏν σε άλλον λογαÏιασμό χÏήστη + +
+
+
+Σε συνδιάλεξη - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να ξεκινοÏν συνδιαλέξεις μέχÏι 6 εξωτεÏικές γÏαμμές. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»ÎµÎ¯ÏƒÎ¹Î¼Î¿- Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να κλείνουν κάθε γÏαμμή. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»Î­ÏˆÎ¹Î¼Î¿ - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να λαμβάνουν και να ανακατευθÏνουν στην εσωτ.σÏνδεσή τους οποιαδήποτε γÏαμμή. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï Î Î±ÏακολοÏθηση - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να λαμβάνουν και να ανακατευθÏνουν στην εσωτ.σÏνδεσή τους οποιαδήποτε γÏαμμή. + +
+
+
+Στάθμευση Κλήσης - Εάν το θέσετε σε αληθές θα επιτÏέπετε σε χÏήστες να σταθμεÏουν κλήσεις και κλήσεις σε αναμονή να διαχειÏίζονται από οποιοδήποτε άλλο χÏήστη. Οι κλήσεις μένουν σε αναμονή για 30 δευτεÏόλεπτα και μετά κλείνουν. Συνήθως ενεÏγοποιημένη για όλς. + +
+
+
+ΕνεÏγοποιημένη ΟυÏά - Εάν το θέσετε σε αληθές θα εμφανίζεται ένα παÏάθυÏο ειδοποίησης, ότι η ÏŽÏα ενημέÏωσης δεν έχει αλλάξει σε 20 δευτεÏόλεπτα. + +
+
+
+AF ΚαταγÏαφή Γεγονότος - Εάν το θέσετε σε αληθές θα καταγÏάφονται οι ενέÏγειες χÏήσης του astGUIclient σε ένα αÏχείο στον υπολογιστή του χÏήστη. + +
+
+
+ΕνεÏγοποιημένη ΟυÏά - Εάν το θέσετε σε αληθές οι εφαÏμογές θα χÏησιμοποιοÏν το ACQS. + +
+
+
+ΥπεÏεμφανιζόμενο παÏαθÏÏο CallerID - Εάν το θέσετε σε αληθές θα επιτÏέψετε σε αÏιθμοÏÏ‚ οÏισμένους στο αÏχείο extensions.conf, να στέλνουν οθόνες με CallerID στους astGUIclient χÏήστες. + +
+
+
+VMail ΠλήκτÏο - Εάν το θέσετε σε αληθές θα εμφανιστεί το πλήκτÏο VOICEMAIL και τα μηνÏματα μποÏοÏν να εμφανίζονται στο astGUIclient. + +
+
+
+ΤαχÏτητα Ανανέωσης - Εάν το σετε σε αληθές ενεÏγοποιείται ένα νέο Ïυθμό ανανέωσης πληÏοφοÏιών κλήσης για το astGUIclient. ΠÏοκαθοÏισμένος απενεÏγοποιημένος Ïυθμός είναι 1000 ms (1 δευτεÏόλεπτο). + +
+
+
+Ρυθμός Ανανέωσης ΤαχÏτητας - σε χιλιοστά δευτεÏολέπτου. ΧÏημοποιείται μόνο εάν η ΤαχÏτητα Ανανέωσης είναι ενεÏγοποιημένη. ΠÏοκαθοÏισμένος απενεÏγοποιημένος Ïυθμός είναι 1000 ms (1 δευτεÏόλεπτο). + +
+
+
+Συνεχής MySQL - Εάν είναι ενεÏγοποιημένο, το astGUIclient θα παÏαμένει συνδεμένο αντί να συνδέεται κάθε δευτεÏόλεπτο. + +
+
+
+Αυτόματη Κλήση Επόμενου ΑÏιθμ - Εάν είναι ενεÏγοποιημένο, μετά από τον τεÏματισμό θα γίνει κλήση του επόμενου αÏιθμοÏ, εκτός εάν επιλέξουμε "Μη κάνεις κλήσεις". + +
+
+
+Σταμάτα την ηχογÏάφηση μετά από κάθε κλήση - Εάν είναι ενεÏγοποιημένο η ηχογÏάφηση θα σταματήσει μετά τον τεÏματισμό. + +
+
+
+DBΧ Διακομιστής - Ο διακομιστής της Βάσης Δεδομένων MySQL που ο χÏήστης θα συνδεθεί. + +
+
+
+DBΧ Βάση Δεδομένων - Η βάση δεδομένων MySQL στην οποία ο χÏήστης θα συνδεθεί. Η Ï€ÏοκαθοÏισμένη είναι asterisk. + +
+
+
+DBΧ ΧÏήστης - Ο χÏήστης MySQL για την σÏνδεση. Ο Ï€ÏοκαθοÏισμένος είναι cron. + +
+
+
+DBΧ Κωδικός - Ο κωδικός χÏήστη MySQL που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Ο Ï€ÏοκαθοÏισμένος είναι 1234. + +
+
+
+DBΧ ΠόÏτα - Η MySQL TCP πόÏτα που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Η Ï€ÏοκαθοÏισμένη είναι 3306. + +
+
+
+DBY Διακομιστής - Ο διακομιστής της Βάσης Δεδομένων MySQL που ο χÏήστης θα συνδεθεί. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY Βάση Δεδομένων - Η βάση δεδομένων MySQL στην οποία ο χÏήστης θα συνδεθεί. Η Ï€ÏοκαθοÏισμένη είναι asterisk. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY ΧÏήστης - Ο χÏήστης MySQL για την σÏνδεση. Ο Ï€ÏοκαθοÏισμένος είναι cron. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY Κωδικός - Ο κωδικός χÏήστη MySQL που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Ο Ï€ÏοκαθοÏισμένος είναι 1234. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY ΠόÏτα - Η MySQL TCP πόÏτα που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Η Ï€ÏοκαθοÏισμένη είναι 3306. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + + +



+ +ΠΙÎΑΚΑΣ ΔΙΑΚΟΜΙΣΤΩÎ

+
+
+ID Διακομιστή - Σε αυτό το πεδίο οÏίζεται το όνομα του διακομιστή Asterisk, είναι μόνο μία επονομία ώστε να αναγνωÏίζεται από τους διαχειÏιστές. + +
+
+
+ΠεÏιγÏαφή Διακομιστή - Το πεδίο στο οποίο πεÏιγÏάφεται με μία φÏάση τον διακομιστή Asterisk. + +
+
+
+Δνση IP Διακομιστή - Το πεδίο που οÏίζεται η δνση IP του δικτÏου του διακομιστή Asterisk. + +
+
+
+ΕνεÏγός - ΟÏίζει κατά πόσον ο διακομιστής Asterisk είναι ενεÏγός ή μη ενεÏγός. + +
+
+
+Εκδοση Asterisk. + +
+
+
+Μέγιστος ΑÏιθμός Trunk του VICIDIAL - Αυτό το πεδίο θα Ï€ÏοσδιοÏίσει τον μέγιστο αÏιθμό γÏαμμών, τις οποίες θα χÏησιμοποιήσει η διεÏγασία αυτόματης κλήσης. Εάν θέλετε να αφιεÏώσετε δÏο PRI σε ένα διακομιστή τότε θα Ï€Ïέπει να το οÏίσετε σε 46. Το Ï€ÏοκαθοÏισμένο είναι 96. + +
+
+
+Telnet Πελάτης - Αυτή είναι η δνση ή το όνομα του διακομιστή Asterisk και το πώς οι εφαÏμογές διαχείÏισης συνδέονται σε αυτόν, όπου Ï„Ïέχουν. Το Ï€ÏοκαθοÏισμένο είναι 'localhost'. + +
+
+
+ΠόÏτα Telnet - Αυτή είνα η πόÏτα της σÏνδεσης με τον διαχειÏιστή του διακομιστή Asterisk και το πώς οι εφαÏμογές διαχείÏισης συνδέονται σε αυτόν, όπου Ï„Ïέχουν. Το Ï€ÏοκαθοÏισμένο είναι '5038'. + +
+
+
+ΧÏήστης ΔιαχειÏιστή - Το όνομα χÏήστη που χÏησιμοποιείτε γενικά για τον διαχειÏιστή του διακομιστή Asterisk. Το Ï€ÏοκαθοÏισμένο είναι 'cron' + +
+
+
+Μυστικό ΔιαχειÏιστή - Το μυστικό ή κωδικός που χÏησιμοποιείτε γενικά για τον διαχειÏιστή του διακομιστή Asterisk. Το Ï€ÏοκαθοÏισμένο είνα '1234' + +
+
+
+ΕνημέÏωση ΧÏήστη ΔιαχειÏιστή - Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες ενημέÏωσεις. Το Ï€ÏοκαθοÏισμένο είναι 'updatecron'. + +
+
+
+Αποστολή ΧÏήστη ΔιαχειÏιστή- Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες που μόνο ακοÏν για έξοδο. Το Ï€ÏοκαθοÏισμένο είναι 'listencron'. + +
+
+
+Αποστολή ήστη ΔιαχειÏιστή- Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες που μόνο στέλνουν ΕνέÏγειες στον διαχειÏιστή.Το Ï€ÏοκαθοÏισμένο είναι 'sendcron'. + +
+
+
+GMT offset Διακομίστε - Η διαφοÏά σε ÏŽÏες από την GMT ÏŽÏα που δεν έχει Ïυθμιστεί με Daylight-Savings-Time. Το Ï€ÏοκαθοÏισμένο είνα '-5' + +
+
+
+VMail εσωτ.σÏνδεση απόÏÏιψης - Το Ï€Ïόθεμα εσωτ.σÏνδεσης που χÏησιμοποιείται στον διακομιστή για να στείλει τις κλήσεις κατευθείαν μέσω agc σε ένα συγκεκÏιμένο φωνητικό ταχυδÏομείο. Το Ï€ÏοκαθοÏισμένο είναι '85026666666666' + +
+
+
+VICIDIAL AD εσωτ.σÏνδεση - Η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση εάν δεν έχει οÏιστεί στην εκστÏατεία για να στείλει Ï‚ κλήσεις στην διεÏγασία αυτόματης κλήσης. Η Ï€ÏοκαθοÏισμένη είναι '8365' + +
+
+
+ΠÏοκαθοÏισμένο ΠεÏιεχόμενο - Το Ï€ÏοκαθοÏισμένο πεÏιεχόμενο του σχέδιου κλήσεων για διεÏγασίες του διακομιστή. Το Ï€ÏοκαθοÏισμένο είναι 'Ï€ÏοκαθοÏισμένο' + + +



+ +ΠΙÎΑΚΑΣ ΣΥÎΔΙΑΛΕΞΕΩÎ

+
+
+ΑÏιθμός Συνδιάλεξης - Αυτό το πεδίο είναι για τον αÏιθμό συνδιάλεξης meetme στο σχέδιο κλήσεων. Επίσης, συνιστοÏμε ο αÏιθμός meetme στο meetme.conf να ταιÏιάζει με αυτό τον αÏιθμό για κάθε καταχώÏηση. Αυτό είναι για τις συνδιαλέξε στο astGUIclient και χÏησιμοποιείται για την λειτουÏγία αποχώÏησης από κλήση με 3 γÏαμμές στο VICIDIAL. + +
+
+
+IP Διακομιστή- Ο κατάλογος που επιλέξατε τον διακομιστή ASTERISK όπου η συνδιάλεξη θα είναι. + + + + + + +







+







+ΤΕΛΟΣ +
+ + + +ΔΙΑΧ ASTERISK: ΔιαχείÏιση - <? echo $process ?> + + + +
+ + + + + + +
  ASTERISK ADMIN - ΑΠΟΣΥÎΔΕΣΗ  
  ΛΙΣΤΑ ΟΛΩΠΤΩΠΤΗΛΕΦΩÎΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΤΗΛΕΦΩÎΟΥ | ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΟΥ | ΠΡΟΣΘΗΚΗ ΔΙΑΚΟΜΙΣΤΗ | ΛΙΣΤΑ ΟΛΩΠΤΩΠΔΙΑΚΟΜΙΣΤΩÎ
  ΕΜΦΑÎΙΣΗ ΟΛΩΠΤΩΠΣΥÎΔΙΑΛΕΞΕΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΣΥÎΔΙΑΛΕΞΗΣ
+"; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΤΗΛΕΦΩÎΟΥ
\n"; +echo "\n"; +echo "
\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Τηλ.σÏνδεσης τηλεφώνου: $NWB#phones-extension$NWE
ΑÏιθμός Σχεδίου Κλήσεων: (μόνο αÏιθμοί)$NWB#phones-dialplan_number$NWE
ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου: (μόνο αÏιθμοί)$NWB#phones-voicemail_id$NWE
ΕξεÏχόμενο CallerID: (μόνο αÏιθμοί)$NWB#phones-outbound_cid$NWE
Δνση IP Τηλεφώνου: (optional)$NWB#phones-phone_ip$NWE
Δνση IP Υπολογιστή: (optional)$NWB#phones-computer_ip$NWE
IP Διακομιστή: $NWB#phones-server_ip$NWE
ΣÏνδεση:$NWB#phones-login$NWE
Κωδικός:$NWB#phones-pass$NWE
Κατάσταση:$NWB#phones-status$NWE
ΕνεÏγός ΛογαÏιασμοÏ: $NWB#phones-active$NWE
ΤÏπος τηλεφώνου: $NWB#phones-phone_type$NWE
ΠλήÏες Ονομα: $NWB#phones-fullname$NWE
ΕταιÏία:$NWB#phones-company$NWE
Εικόνα:$NWB#phones-picture$NWE
ΠÏοτόκολο Πελάτη: $NWB#phones-protocol$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#phones-local_gmt$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW SERVERS FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΔΙΑΚΟΜΙΣΤΗ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Διακομιστή: $NWB#servers-server_id$NWE
ΠεÏιγÏαφή Διακομιστή: $NWB#servers-server_description$NWE
Δνση IP Διακομιστή: $NWB#servers-server_ip$NWE
ΕνεÏγός:$NWB#servers-active$NWE
Εκδοση Asterisk: $NWB#servers-asterisk_version$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW CONFERENCES FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΣΥÎΔΙΑΛΕΞΗΣ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΑÏιθμός Συνδιάλεξης: (μόνο αÏιθμοί)$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
\n"; + +} + + +###################### +# ADD=2 adds the new phone to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένα τηλέφωνο με αυτή την εσωτ.σÏνδεση/διακομιστή\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new server to the system +###################### + +if ($ADD==21) +{ + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένας διακομιστής με αυτό το ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new conference to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία συνδιάλεξη με αυτό το ID και διακομιστή\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=100; +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of phone +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGdelete_phones < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΤΗΛΕΦΩÎΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΤΗΛΕΦΩÎΙΚΗΣ ΔΙΑΓΡΑΦΗΣ: $extension - $server_ip\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το τηλέφωνο $extension - $server_ip


\n"; + } + +$ADD='3'; # go to phone modification below +} + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete phone record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGdelete_phones < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΤΗΛΕΦΩÎΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ ΤΗΛΕΦΩÎΙΚΗ: $extension - $server_ip\n"; + echo "

\n"; + } + +$ADD='0'; # go to phone list +} + + + + + + +###################### +# ADD=3 modify phone info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΤΗΛΕΦΩÎΟΥ: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Τηλ.σÏνδεσης τηλεφώνου: $NWB#phones-extension$NWE
ΑÏιθμός Σχεδίου Κλήσεων: (μόνο αÏιθμοί)$NWB#phones-dialplan_number$NWE
ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου: (μόνο αÏιθμοί)$NWB#phones-voicemail_id$NWE
ΕξεÏχόμενο CallerID: (μόνο αÏιθμοί)$NWB#phones-outbound_cid$NWE
Δνση IP Τηλεφώνου: (optional)$NWB#phones-phone_ip$NWE
Δνση IP Υπολογιστή: (optional)$NWB#phones-computer_ip$NWE
IP Διακομιστή: $NWB#phones-server_ip$NWE
ΣÏνδεση:$NWB#phones-login$NWE
Κωδικός:$NWB#phones-pass$NWE
Κατάσταση:$NWB#phones-status$NWE
ΕνεÏγός ΛογαÏιασμοÏ: $NWB#phones-active$NWE
ΤÏπος τηλεφώνου: $NWB#phones-phone_type$NWE
ΠλήÏες Ονομα: $NWB#phones-fullname$NWE
ΕταιÏία:$NWB#phones-company$NWE
Εικόνα:$NWB#phones-picture$NWE
Îέα ΜηνÏματα: $row[14]$NWB#phones-messages$NWE
Παλαιά ΜηνÏματα: $row[15]$NWB#phones-old_messages$NWE
ΠÏοτόκολο Πελάτη: $NWB#phones-protocol$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#phones-local_gmt$NWE
Manager ΣÏνδεση:$NWB#phones-ASTmgrUSERNAME$NWE
ΔιαχειÏιστή Μυστικό: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL ΠÏοκαθοÏισμένος ΧÏήστης: $NWB#phones-login_user$NWE
VICIDIAL ΠÏοκαθοÏισμένος Κωδικός: $NWB#phones-login_pass$NWE
VICIDIAL ΠÏοκαθοÏισμένη εκστÏατεία: $NWB#phones-login_campaign$NWE
Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-park_on_extension$NWE
Τηλ.σÏνδ. Συνδ.: $NWB#phones-conf_on_extension$NWE
VICIDIAL Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL ΑÏχείο Στάθμευσης: $NWB#phones-VICIDIAL_park_on_filename$NWE
ΠÏόθεμα ΠαÏακολοÏθησης: $NWB#phones-monitor_prefix$NWE
ΗχογÏάφηση εσωτ.σÏνδ.: $NWB#phones-recording_exten$NWE
VMailMain Τηλ.σÏνδ.: $NWB#phones-voicemail_exten$NWE
VMailDump Τηλ.σÏνδ.: $NWB#phones-voicemail_dump_exten$NWE
ΠεÏιεχόμενο Τηλ.σÏνδ: $NWB#phones-ext_context$NWE
DTMFSend Κανάλι: $NWB#phones-dtmf_send_extension$NWE
Ομάδα ΕξεÏχομένων Κλήσεων: $NWB#phones-call_out_number_group$NWE
Θέση ΦυλλομετÏητή: $NWB#phones-client_browser$NWE
Κατάλογος εγκατάστασης: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL ΠÏοκαθοÏισμένο URL: $NWB#phones-VICIDIAL_web_URL$NWE
ΚαταγÏαφή Γεγονότος Κλήσης: $NWB#phones-AGI_call_logging_enabled$NWE
Μεταγωγή ΧÏήστη: $NWB#phones-user_switching_enabled$NWE
Σε συνδιαλέξη: $NWB#phones-conferencing_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»ÎµÎ¯ÏƒÎ¹Î¼Î¿: $NWB#phones-admin_hangup_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»Î­ÏˆÎ¹Î¼Î¿: $NWB#phones-admin_hijack_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï Î Î±ÏακολοÏθηση: $NWB#phones-admin_monitor_enabled$NWE
Στάθμευση Κλήσης: $NWB#phones-call_parking_enabled$NWE
Ελεγχος ενημεÏωτή: $NWB#phones-updater_check_enabled$NWE
AF ΚαταγÏαφή Γεγονότος: $NWB#phones-AFLogging_enabled$NWE
ΕνεÏγή ΟυÏά: $NWB#phones-QUEUE_ACTION_enabled$NWE
ΥπεÏεμφανιζόμενο παÏαθÏÏο CallerID: $NWB#phones-CallerID_popup_enabled$NWE
ΠλήκτÏο VMail: $NWB#phones-voicemail_button_enabled$NWE
ΤαχÏτητα Ανανέωσης: $NWB#phones-enable_fast_refresh$NWE
ΤαχÏτητα Ανανέωσης Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Συνεχής MySQL: $NWB#phones-enable_persistant_mysql$NWE
Αυτόματη Κλήση Επόμενου ΑÏιθμοÏ: $NWB#phones-auto_dial_next_number$NWE
Σταμάτα την ηχογÏάφηση μετά από κάθε κλήση: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Διακομιστής: (ΠÏωταÏχικό DB Server)$NWB#phones-DBX_server$NWE
DBX Βάση Δεδομένων: (ΠÏωταÏχικό Server Database)$NWB#phones-DBX_database$NWE
DBX ΧÏήστης: (ΠÏωταÏχικό DB Login)$NWB#phones-DBX_user$NWE
DBX Κωδικός: (ΠÏωταÏχικό DB Secret)$NWB#phones-DBX_pass$NWE
DBX ΠόÏτα: (ΠÏωταÏχικό DB Port)$NWB#phones-DBX_port$NWE
DBY Διακομιστής: (ΔευτεÏεÏονDB Server)$NWB#phones-DBY_server$NWE
DBY Βάση Δεδομένων: (ΔευτεÏεÏονServer Database)$NWB#phones-DBY_database$NWE
DBY ΧÏήστης: (ΔευτεÏεÏονDB Login)$NWB#phones-DBY_user$NWE
DBY Κωδικός: (ΔευτεÏεÏονDB Secret)$NWB#phones-DBY_pass$NWE
DBY ΠόÏτα: (ΔευτεÏεÏονDB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Πατήστε εδώ για στατιστικά τηλεφώνου\n"; + +if ($LOGdelete_phones > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟ ΤΟ ΤΗΛΕΦΩÎΟ\n"; + } + +} + + +###################### +# ADD=31 modify server info in the system +###################### + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΑΦΗΣ ΔΙΑΚΟΜΙΣΤΗ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Διακομιστή: $NWB#servers-server_id$NWE
ΠεÏιγÏαφή Διακομιστή: $NWB#servers-server_description$NWE
Δνση IP Διακομιστή: $NWB#servers-server_ip$NWE
ΕνεÏγός:$NWB#servers-active$NWE
Εκδοση Asterisk: $NWB#servers-asterisk_version$NWE
Μέγιστος ΑÏιθμός Trunk του VICIDIAL: $NWB#servers-max_vicidial_trunks$NWE
Λήπτης Telnet: $NWB#servers-telnet_host$NWE
ΠόÏτα Telnet: $NWB#servers-telnet_port$NWE
ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAME$NWE
ΔιαχειÏιστή Μυστικό: $NWB#servers-ASTmgrSECRET$NWE
ΕνημέÏωση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
ΠαÏακολοÏθηση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Αποστολή ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#servers-local_gmt$NWE
VMail εσωτ.σÏνδεση απόÏÏιψης: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD εσωτ.σÏνδεση: $NWB#servers-answer_transfer_agent$NWE
ΠÏοκαθοÏισμένο ΠεÏιεχόμενο: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
ΤΗΛΕΦΩÎΑ ΣΤΟΠΔΙΑΚΟΜΙΣΤΗ:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ΤΗΛ.ΣΥÎΔΕΣΗΟÎΟΜΑΕÎΕΡΓΑ
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Αυτός ο διακομιστής έχει $active_lists ενεÏγά τηλέφωνα και $inactive_lists μη ενεÏγά τηλέφωνα

\n"; +echo "
\n"; +} + + +###################### +# ADD=311 modify conference info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΣΥÎΔΙΑΛΕΞΗΣ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Συνδιαλέξη:$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
ΙσχÏουσα εσωτ.σÏνδεση:
\n"; + +echo "
\n"; + +} + + + +###################### +# ADD=4 submit phone modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη ένα τηλέφωνο με αυτή την εσωτ.σÏνδεση/διακομιστή\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='$local_web_callerID_URL', VICIDIAL_web_URL='$VICIDIAL_web_URL', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΤΗΛΕΦΩÎΟΥ: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Τηλ.σÏνδεσης τηλεφώνου: $NWB#phones-extension$NWE
ΑÏιθμός Σχεδίου Κλήσεων: (μόνο αÏιθμοί)$NWB#phones-dialplan_number$NWE
ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου: (μόνο αÏιθμοί)$NWB#phones-voicemail_id$NWE
ΕξεÏχόμενο CallerID: (μόνο αÏιθμοί)$NWB#phones-outbound_cid$NWE
Δνση IP Τηλεφώνου: (optional)$NWB#phones-phone_ip$NWE
Δνση IP Υπολογιστή: (optional)$NWB#phones-computer_ip$NWE
IP Διακομιστή: $NWB#phones-server_ip$NWE
ΣÏνδεση:$NWB#phones-login$NWE
Κωδικός:$NWB#phones-pass$NWE
Κατάσταση:$NWB#phones-status$NWE
ΕνεÏγός ΛογαÏιασμοÏ: $NWB#phones-active$NWE
ΤÏπος τηλεφώνου: $NWB#phones-phone_type$NWE
ΠλήÏες Ονομα: $NWB#phones-fullname$NWE
ΕταιÏία:$NWB#phones-company$NWE
Εικόνα:$NWB#phones-picture$NWE
Îέα ΜηνÏματα: $row[14]$NWB#phones-messages$NWE
Παλαιά ΜηνÏματα: $row[15]$NWB#phones-old_messages$NWE
ΠÏοτόκολο Πελάτη: $NWB#phones-protocol$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#phones-local_gmt$NWE
Manager ΣÏνδεση:$NWB#phones-ASTmgrUSERNAME$NWE
ΔιαχειÏιστή Μυστικό: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL ΠÏοκαθοÏισμένος ΧÏήστης: $NWB#phones-login_user$NWE
VICIDIAL ΠÏοκαθοÏισμένος Κωδικός: $NWB#phones-login_pass$NWE
VICIDIAL ΠÏοκαθοÏισμένη εκστÏατεία: $NWB#phones-login_campaign$NWE
Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-park_on_extension$NWE
Τηλ.σÏνδ. Συνδ.: $NWB#phones-conf_on_extension$NWE
VICIDIAL Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL ΑÏχείο Στάθμευσης: $NWB#phones-VICIDIAL_park_on_filename$NWE
ΠÏόθεμα ΠαÏακολοÏθησης: $NWB#phones-monitor_prefix$NWE
ΗχογÏάφηση εσωτ.σÏνδ.: $NWB#phones-recording_exten$NWE
VMailMain Τηλ.σÏνδ.: $NWB#phones-voicemail_exten$NWE
VMailDump Τηλ.σÏνδ.: $NWB#phones-voicemail_dump_exten$NWE
ΠεÏιεχόμενο Τηλ.σÏνδ: $NWB#phones-ext_context$NWE
DTMFSend Κανάλι: $NWB#phones-dtmf_send_extension$NWE
Ομάδα ΕξεÏχομένων Κλήσεων: $NWB#phones-call_out_number_group$NWE
Θέση ΦυλλομετÏητή: $NWB#phones-client_browser$NWE
Κατάλογος εγκατάστασης: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL ΠÏοκαθοÏισμένο URL: $NWB#phones-VICIDIAL_web_URL$NWE
ΚαταγÏαφή Γεγονότος Κλήσης: $NWB#phones-AGI_call_logging_enabled$NWE
Μεταγωγή ΧÏήστη: $NWB#phones-user_switching_enabled$NWE
Σε συνδιαλέξη: $NWB#phones-conferencing_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»ÎµÎ¯ÏƒÎ¹Î¼Î¿: $NWB#phones-admin_hangup_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»Î­ÏˆÎ¹Î¼Î¿: $NWB#phones-admin_hijack_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï Î Î±ÏακολοÏθηση: $NWB#phones-admin_monitor_enabled$NWE
Στάθμευση Κλήσης: $NWB#phones-call_parking_enabled$NWE
Ελεγχος ενημεÏωτή: $NWB#phones-updater_check_enabled$NWE
AF ΚαταγÏαφή Γεγονότος: $NWB#phones-AFLogging_enabled$NWE
ΕνεÏγή ΟυÏά: $NWB#phones-QUEUE_ACTION_enabled$NWE
ΥπεÏεμφανιζόμενο παÏαθÏÏο CallerID: $NWB#phones-CallerID_popup_enabled$NWE
ΠλήκτÏο VMail: $NWB#phones-voicemail_button_enabled$NWE
ΤαχÏτητα Ανανέωσης: $NWB#phones-enable_fast_refresh$NWE
ΤαχÏτητα Ανανέωσης Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Συνεχής MySQL: $NWB#phones-enable_persistant_mysql$NWE
Αυτόματη Κλήση Επόμενου ΑÏιθμοÏ: $NWB#phones-auto_dial_next_number$NWE
Σταμάτα την ηχογÏάφηση μετά από κάθε κλήση: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Διακομιστής: (ΠÏωταÏχικό DB Server)$NWB#phones-DBX_server$NWE
DBX Βάση Δεδομένων: (ΠÏωταÏχικό Server Database)$NWB#phones-DBX_database$NWE
DBX ΧÏήστης: (ΠÏωταÏχικό DB Login)$NWB#phones-DBX_user$NWE
DBX Κωδικός: (ΠÏωταÏχικό DB Secret)$NWB#phones-DBX_pass$NWE
DBX ΠόÏτα: (ΠÏωταÏχικό DB Port)$NWB#phones-DBX_port$NWE
DBY Διακομιστής: (ΔευτεÏεÏονDB Server)$NWB#phones-DBY_server$NWE
DBY Βάση Δεδομένων: (ΔευτεÏεÏονServer Database)$NWB#phones-DBY_database$NWE
DBY ΧÏήστης: (ΔευτεÏεÏονDB Login)$NWB#phones-DBY_user$NWE
DBY Κωδικός: (ΔευτεÏεÏονDB Secret)$NWB#phones-DBY_pass$NWE
DBY ΠόÏτα: (ΔευτεÏεÏονDB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Πατήστε εδώ για στατιστικά τηλεφώνου\n"; + +if ($LOGdelete_phones > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟ ΤΟ ΤΗΛΕΦΩÎΟ\n"; + } + +} + +###################### +# ADD=41 submit server modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη ένας διακομιστής με αυτό το IP\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΑΦΗΣ ΔΙΑΚΟΜΙΣΤΗ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Διακομιστή: $NWB#servers-server_id$NWE
ΠεÏιγÏαφή Διακομιστή: $NWB#servers-server_description$NWE
Δνση IP Διακομιστή: $NWB#servers-server_ip$NWE
ΕνεÏγός:$NWB#servers-active$NWE
Εκδοση Asterisk: $NWB#servers-asterisk_version$NWE
Μέγιστος ΑÏιθμός Trunk του VICIDIAL: $NWB#servers-max_vicidial_trunks$NWE
Λήπτης Telnet: $NWB#servers-telnet_host$NWE
ΠόÏτα Telnet: $NWB#servers-telnet_port$NWE
ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAME$NWE
ΔιαχειÏιστή Μυστικό: $NWB#servers-ASTmgrSECRET$NWE
ΕνημέÏωση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
ΠαÏακολοÏθηση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Αποστολή ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#servers-local_gmt$NWE
VMail εσωτ.σÏνδεση απόÏÏιψης: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD εσωτ.σÏνδεση: $NWB#servers-answer_transfer_agent$NWE
ΠÏοκαθοÏισμένο ΠεÏιεχόμενο: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
ΤΗΛΕΦΩÎΑ ΣΤΟΠΔΙΑΚΟΜΙΣΤΗ:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ΤΗΛ.ΣΥÎΔΕΣΗΟÎΟΜΑΕÎΕΡΓΑ
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Αυτός ο διακομιστής έχει $active_lists ενεÏγά τηλέφωνα και $inactive_lists μη ενεÏγά τηλέφωνα

\n"; +echo "
\n"; + +} + +###################### +# ADD=411 submit conference modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη μία συνδιάλεξη με αυτή την εσωτ.σÏνδεση-διακομιστή\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from conferences where conf_exten='$conf_exten';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
ΤΡΟΠΟΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΣΥÎΔΙΑΛΕΞΗΣ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Συνδιαλέξη:$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
ΙσχÏουσα εσωτ.σÏνδεση:
\n"; + +echo "
\n"; + +} + + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΟΥ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
εσωτ.σÏνδεση:
ΠλήÏες Ονομα:
Phone type:
\n"; + +} + +###################### +# ADD=66 phone search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($extension) {$SQL .= "user LIKE \"%$extension%\" and";} + if ($fullname) {$SQL .= "fullname LIKE \"%$fullname%\" and";} + if ($phone_type) {$SQL .= "phone_type LIKE \"%$phone_type%\" and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from phones $SQL order by extension,server_ip;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΑÎΑΖΗΤΗΣΗ ΑΠΟΤΕΛΕΣΜΑΤΩÎ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ
\n"; + +} + + + +###################### +# ADD=0 display all active phones +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from phones order by extension,server_ip"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΑ ΤΗΛΕΦΩÎΑ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ
\n"; +} + +###################### +# ADD=10 display all servers +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΟΙ ΔΙΑΚΟΜΙΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + +###################### +# ADD=100 display all conferences +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΣΥÎΔΙΑΛΕΞΕΙΣ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_el/dbconnect.php b/LANG_admin/LANG_admin/astguiclient_el/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/astguiclient_el/help.gif b/LANG_admin/LANG_admin/astguiclient_el/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/astguiclient_el/help.gif differ diff --git a/LANG_admin/LANG_admin/astguiclient_el/htglobalize.php b/LANG_admin/LANG_admin/astguiclient_el/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_el/inbound_popup.php b/LANG_admin/LANG_admin/astguiclient_el/inbound_popup.php new file mode 100644 index 0000000..01c78a7 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/inbound_popup.php @@ -0,0 +1,194 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK ΑΠΟΜΑΚΡΥΣΜΕÎΟ ΕΙΣΕΡΧΟΜΕÎΟ: ΥπεÏεμφανιζόμενο ΠαÏαθÏÏο + + +
+ + 0) +{ + + $stmt="DELETE from parked_channels where server_ip='$user_server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$user_server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Η εντολή ανακατεÏθυνσης στάλθηκε για το κανάλι $channel       $NOW_TIME\n

\n"; + + + $url = 'https://10.10.10.15/internal/back_end_systems/cust_serv/index.php?Search=SEARCH&'; + $Suser = 'username='; + $Spass = '&passwd='; + $Sphone = '&phone='; + + $newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW$Sphone$phone"; + if ( ($phone == 'unknown') or (strlen($phone)<9) ) + {$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW";} + + echo "Αναζήτηση του Πελάτη στο ΣÏστημα ΕξυπηÏέτησης Πελατών\n

\n"; + + echo "Κλείσε αυτό το παÏάθυÏο\n

\n"; +} +else +{ + echo "Η εντολή ανακατεÏθυνσης ΑΠΕΤΥΧΕ για το κανάλι $channel       $NOW_TIME\n

\n"; + echo "Κλείσε αυτό το παÏάθυÏο\n

\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_el/phone_stats.php b/LANG_admin/LANG_admin/astguiclient_el/phone_stats.php new file mode 100644 index 0000000..2b65d0a --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/phone_stats.php @@ -0,0 +1,228 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK ADMIN: Στατιστικά Τηλεφώνου + + +
+
+ + + + + + +\n"; +echo "
  ΔΙΑΧ ASTERISK: ΔιαχείÏιση  
  ΛΙΣΤΑ ΟΛΩΠΤΩΠΤΗΛΕΦΩÎΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΤΗΛΕΦΩÎΟΥ | ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΟΥ | ΠΡΟΣΘΗΚΗ ΔΙΑΚΟΜΙΣΤΗ | ΛΙΣΤΑ ΟΛΩΠΤΩΠΔΙΑΚΟΜΙΣΤΩÎ
  ΕΜΦΑÎΙΣΗ ΟΛΩΠΤΩΠΣΥÎΔΙΑΛΕΞΕΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΣΥÎΔΙΑΛΕΞΗΣ
  \n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "ΧΡΟÎΟΣ ΟΜΙΛΙΑΣ ΚΑΙ ΚΑÎΑΛΙΑ:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
ΚΑÎΑΛΙ ΟΜΑΔΑΣ ΚΑΤΑΜΕΤΡΗΣΗ ΩΡΕΣ:ΛΕΠΤΑ
$row[1] $row[0] $call_hours_int:$call_minutes_int
ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "ΤΕΛΕΥΤΑΙΕΣ 1000 ΚΛΗΣΕΙΣ ΓΙΑ ΤΟ ΔΙΑΣΤΗΜΑ ΗΜΕΡΟΜΗÎΙΑΣ:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
ΑΡΙΘΜΟΣ ΚΑÎΑΛΙ ΟΜΑΔΑΣ ΗΜΕΡΑ LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_el/remote_inbound.php b/LANG_admin/LANG_admin/astguiclient_el/remote_inbound.php new file mode 100644 index 0000000..bcdac2e --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_el/remote_inbound.php @@ -0,0 +1,165 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + echo"\n"; + echo"ASTERISK ΑΠΟΜΑΚΡΥΣΜΕÎΟ ΕΙΣΕΡΧΟΜΕÎΟ: ΚÏÏιο\n"; + echo"\n"; + echo"\n"; + echo"\n"; + +?> + + +
+ +
\n"; + +echo "Πατήστε στο κανάλι παÏακάτω, που θα επιθυμοÏσατε να έχετε κατευθÏνει στο τηλέφωνό σας

\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME        \n";
+echo "----------------------------------------------------------------------------------------------\n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' order by parked_time";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$user_server_ip' and channel_group LIKE \"IN_%\" order by parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$extension =		sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		echo "$channel$server$channel_group$extension$parked_by$parked_time\n";
+
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "*************************************** NO PARKED CALLS **************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_en/AST_inboundEXTstats.php b/LANG_admin/LANG_admin/astguiclient_en/AST_inboundEXTstats.php new file mode 100644 index 0000000..db7d080 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/AST_inboundEXTstats.php @@ -0,0 +1,369 @@ + + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Inbound Calls Stats\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Calls Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls That came into this number:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+echo "| CALLERID   | CALLERIDNAME    | LENGTH | DATE TIME           |\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-10s", $row[0]);
+	$CIDname =		sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+------------+-----------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_en/admin.php b/LANG_admin/LANG_admin/astguiclient_en/admin.php new file mode 100644 index 0000000..ed848d1 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/admin.php @@ -0,0 +1,1627 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$STARTtime = date("U"); +$STARTdate = date("Y-m-d H:i:s"); + +if ($ADD==1) {$process = 'ADD NEW PHONE';} +if ($ADD==11) {$process = 'ADD NEW SERVER';} +if ($ADD==111) {$process = 'ADD NEW CONFERENCE';} +if ($ADD==2) {$process = 'ADDING NEW PHONE';} +if ($ADD==21) {$process = 'ADDING NEW SERVER';} +if ($ADD==211) {$process = 'ADDING NEW CONFERENCE';} +if ($ADD==3) {$process = 'MODIFY PHONE';} +if ($ADD==31) {$process = 'MODIFY SERVER';} +if ($ADD==311) {$process = 'MODIFY CONFERENCE';} +if ($ADD==4) {$process = 'MODIFYING PHONE';} +if ($ADD==41) {$process = 'MODIFYING SERVER';} +if ($ADD==411) {$process = 'MODIFYING CONFERENCE';} +if ($ADD==5) {$process = 'DELETE PHONE';} +if ($ADD==6) {$process = 'DELETE PHONE';} +if ($ADD==55) {$process = 'SEARCH PHONES';} +if ($ADD==66) {$process = 'SEARCH PHONES RESULTS';} +if ($ADD==0) {$process = 'PHONE LIST';} +if ($ADD==10) {$process = 'SERVER LIST';} +if ($ADD==100) {$process = 'CONFERENCE LIST';} +if ($ADD==99999) {$process = 'HELP';} + + $stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status='ADMIN';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if ($auth<1) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > '6' and ast_admin_access='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGdelete_phones =$row[17]; + } + } + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + echo "|$stmt|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + if (strlen($LOGfullname) < 1) + { + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); + +$NWB = "   \"HELP\""; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "ASTERISK ADMIN: Administration - $process \n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
ASTERISK ADMIN: HELP


\n"; + +?> +PHONES TABLE

+ +
+Phone extension - This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone. + +
+
+
+Dialplan number - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Box - This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app. + +
+
+
+Outbound CallerID - This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS, non-PRI, T1/E1s. + +
+
+
+Phone IP address - This field is for the phone's IP address if it is a VOIP phone. This is an optional field + +
+
+
+Computer IP address - This field is for the user's computer IP address. This is an optional field + +
+
+
+Server IP - This menu is where you select which server the phone is active on. + +
+
+
+Login - The login used for the phone user to get to admin functions. + +
+
+
+Password - The password used for the phone user to get to admin functions. + +
+
+
+Status - The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access. + +
+
+
+Active Account - Whether the phone is active to put it in the list in the GUI client. + +
+
+
+Phone Type - Purely for administrative notes. + +
+
+
+Full Name - Used by the GUIclient in the list of active phones. + +
+
+
+Company - Purely for administrative notes. + +
+
+
+Picture - Not yet Implemented. + +
+
+
+New Messages - Number of new voicemail messages for this phone on the Asterisk server. + +
+
+
+Old Messages - Number of old voicemail messages for this phone on the Asterisk server. + +
+
+
+Client Protocol - The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones. + +
+
+
+Local GMT - 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 VICIDIAL campaign to accurately display the time and customer time. + +
+
+
+Manager Login - This is the login that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+Manager Secret - This is the password that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+VICIDIAL Default User - This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user. + +
+
+
+VICIDIAL Default Pass - This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass. + +
+
+
+VICIDIAL Default Campaign - This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign. + +
+
+
+Park Exten - This is the default Parking extension for the client apps. Verify that a different one works before you change this. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park File - This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters. + +
+
+
+Monitor Prefix - This is the dialplan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Recording Exten - This is the dialplan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing. + +
+
+
+VMAIL Main Exten - This is the dialplan extension going to check your voicemail. verify with extensions.conf file before changing. + +
+
+
+VMAIL Dump Exten - This is the dialplan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing. + +
+
+
+Exten Context - This is the dialplan context that this phone 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. + +
+
+
+DTMF send Channel - This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file. + +
+
+
+Outbound Call Group - This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file, it is usually what you have defined as the TRUNK global variable at the top of the file. + +
+
+
+Browser Location - This is applicable to only UNIX/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually. + +
+
+
+Install Directory - This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like /usr/local/perl_TK. verify this manually. + +
+
+
+CallerID URL - This is the web address of the page used to do custom callerID lookups. default testing address is: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Default URL - This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Call Logging - This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hangup 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly. + +
+
+
+User Switching - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Set to true to allow user to start conference calls with upto six external lines. + +
+
+
+Admin Hangup - Set to true to allow user to be able to hangup any line at will through astGUIclient. Good idea only to enable this for Admin users. + +
+
+
+Admin Hijack - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers. + +
+
+
+Admin Monitor - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool. + +
+
+
+Call Park - Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hangup. Usually enabled for all. + +
+
+
+Updater Check - Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users. + +
+
+
+AF Logging - Set to true to log many actions of astGUIclient usage to a text file on the user's computer. + +
+
+
+Queue Enabled - Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users. + +
+
+
+CallerID Popup - Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users. + +
+
+
+VMail Button - Set to true to display the VOICEMAIL button and the messages count display on astGUIclient. + +
+
+
+Fast Refresh - Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Fast Refresh Rate - in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Persistant MySQL - If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine. + +
+
+
+Auto Dial Next Number - If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen. + +
+
+
+Stop Rec after each call - If enabled the VICIDIAL client 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. + +
+
+
+DBX Server - The MySQL database server that this user should be connecting to. + +
+
+
+DBX Database - The MySQL database that this user should be connecting to. Default is asterisk. + +
+
+
+DBX User - The MySQL user login that this user should be using when connecting. Default is cron. + +
+
+
+DBX Pass - The MySQL user password that this user should be using when connecting. Default is 1234. + +
+
+
+DBX Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. + +
+
+
+DBY Server - The MySQL database server that this user should be connecting to. Secondary server, not used currently. + +
+
+
+DBY Database - The MySQL database that this user should be connecting to. Default is asterisk. Secondary server, not used currently. + +
+
+
+DBY User - The MySQL user login that this user should be using when connecting. Default is cron. Secondary server, not used currently. + +
+
+
+DBY Pass - The MySQL user password that this user should be using when connecting. Default is 1234. Secondary server, not used currently. + +
+
+
+DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. + + +



+ +SERVERS TABLE

+
+
+Server ID - This field is where you put the Asterisk servers name, doesnt have to be an official domain sub, just a nickname to identify the server to Admin users. + +
+
+
+Server Description - The field where you use a small phrase to describe the Asterisk server. + +
+
+
+Server IP Address - The field where you put the Network IP address of the Asterisk server. + +
+
+
+Active - Set whether the Asterisk server is active or inactive. + +
+
+
+Asterisk Version - Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local/ channels, a bug that has been fixed in CVS v1.0, and need to be treated differently when handling their Local/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well. + +
+
+
+Max VICIDIAL Trunks - This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96. + +
+
+
+Telnet Host - This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine. + +
+
+
+Telnet Port - This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install. + +
+
+
+Manager User - The username or login used to connect genericly to the Asterisk server manager. Default is 'cron' + +
+
+
+Manager Secret - The secret or password used to connect genericly to the Asterisk server manager. Default is '1234' + +
+
+
+Manager Update User - The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user. + +
+
+
+Manager Listen User - The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user. + +
+
+
+Manager Send User - The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user. + +
+
+
+Server GMT offset - The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5' + +
+
+
+VMail Dump Exten - The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666' + +
+
+
+VICIDIAL AD extension - The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365' + +
+
+
+Default Context - The default dialplan context used for scripts that operate for this server. Default is 'default' + + +



+ +CONFERENCES TABLE

+
+
+Conference Number - This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL. + +
+
+
+Server IP - The menu where you select the Asterisk server that this conference will be on. + + + + + + +







+







+THE END +
+ + + +ASTERISK ADMIN: Administration - <? echo $process ?> + + + +
+ + + + + + +
  ASTERISK ADMIN - Logout  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
+"; + +echo "
ADD A NEW PHONE
\n"; +echo "\n"; +echo "
\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW SERVERS FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW SERVER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW CONFERENCES FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW CONFERENCE\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + +} + + +###################### +# ADD=2 adds the new phone to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new server to the system +###################### + +if ($ADD==21) +{ + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVER NOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER ADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new conference to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE ADDED\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=100; +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of phone +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGdelete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
PHONE DELETION CONFIRMATION: $extension - $server_ip\n"; + echo "

Click here to delete phone $extension - $server_ip


\n"; + } + +$ADD='3'; # go to phone modification below +} + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete phone record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGdelete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; + echo "

\n"; + } + +$ADD='0'; # go to phone list +} + + + + + + +###################### +# ADD=3 modify phone info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A PHONE RECORD: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hangup: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Click here for phone stats\n"; + +if ($LOGdelete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + +} + + +###################### +# ADD=31 modify server info in the system +###################### + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A SERVER RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
PHONES WITHIN THIS SERVER:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This server has $active_lists active phones and $inactive_lists inactive phones

\n"; +echo "
\n"; +} + + +###################### +# ADD=311 modify conference info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A CONFERENCE RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + +echo "
\n"; + +} + + + +###################### +# ADD=4 submit phone modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
PHONE NOT MODIFIED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='$local_web_callerID_URL', VICIDIAL_web_URL='$VICIDIAL_web_URL', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A PHONE RECORD: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone extension: $NWB#phones-extension$NWE
Dialplan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hangup: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Click here for phone stats\n"; + +if ($LOGdelete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + +} + +###################### +# ADD=41 submit server modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER MODIFIED: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A SERVER RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
PHONES WITHIN THIS SERVER:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This server has $active_lists active phones and $inactive_lists inactive phones

\n"; +echo "
\n"; + +} + +###################### +# ADD=411 submit conference modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from conferences where conf_exten='$conf_exten';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFY A CONFERENCE RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + +echo "
\n"; + +} + + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
SEARCH FOR A PHONE\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
extension:
Full Name:
Phone type:
\n"; + +} + +###################### +# ADD=66 phone search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($extension) {$SQL .= "user LIKE \"%$extension%\" and";} + if ($fullname) {$SQL .= "fullname LIKE \"%$fullname%\" and";} + if ($phone_type) {$SQL .= "phone_type LIKE \"%$phone_type%\" and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from phones $SQL order by extension,server_ip;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; + +} + + + +###################### +# ADD=0 display all active phones +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from phones order by extension,server_ip"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; +} + +###################### +# ADD=10 display all servers +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SERVER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all conferences +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_en/dbconnect.php b/LANG_admin/LANG_admin/astguiclient_en/dbconnect.php new file mode 100644 index 0000000..fb6d591 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/dbconnect.php @@ -0,0 +1,16 @@ + diff --git a/LANG_admin/LANG_admin/astguiclient_en/help.gif b/LANG_admin/LANG_admin/astguiclient_en/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/astguiclient_en/help.gif differ diff --git a/LANG_admin/LANG_admin/astguiclient_en/htglobalize.php b/LANG_admin/LANG_admin/astguiclient_en/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_en/inbound_popup.php b/LANG_admin/LANG_admin/astguiclient_en/inbound_popup.php new file mode 100644 index 0000000..90f2442 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/inbound_popup.php @@ -0,0 +1,194 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK REMOTE INBOUND: Popup + + +
+ + 0) +{ + + $stmt="DELETE from parked_channels where server_ip='$user_server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$user_server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + + $url = 'https://10.10.10.15/internal/back_end_systems/cust_serv/index.php?Search=SEARCH&'; + $Suser = 'username='; + $Spass = '&passwd='; + $Sphone = '&phone='; + + $newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW$Sphone$phone"; + if ( ($phone == 'unknown') or (strlen($phone)<9) ) + {$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW";} + + echo "Look up this customer in Customer Service System\n

\n"; + + echo "Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Close this window\n

\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_en/phone_stats.php b/LANG_admin/LANG_admin/astguiclient_en/phone_stats.php new file mode 100644 index 0000000..8ca295c --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/phone_stats.php @@ -0,0 +1,228 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK ADMIN: Phone Stats + + +
+
+ + + + + + +\n"; +echo "
  ASTERISK ADMIN: Administration  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
  \n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "CALL TIME AND CHANNELS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
CHANNEL GROUP COUNT HOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LAST 1000 CALLS FOR DATE RANGE:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
NUMBER CHANNEL GROUP DATE LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_en/remote_inbound.php b/LANG_admin/LANG_admin/astguiclient_en/remote_inbound.php new file mode 100644 index 0000000..92bab3c --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_en/remote_inbound.php @@ -0,0 +1,165 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + echo"\n"; + echo"ASTERISK REMOTE INBOUND: Main\n"; + echo"\n"; + echo"\n"; + echo"\n"; + +?> + + +
+ +
\n"; + +echo "Click on the channel below that you would like to have directed to your phone

\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME        \n";
+echo "----------------------------------------------------------------------------------------------\n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' order by parked_time";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$user_server_ip' and channel_group LIKE \"IN_%\" order by parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$extension =		sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		echo "$channel$server$channel_group$extension$parked_by$parked_time\n";
+
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "*************************************** NO PARKED CALLS **************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_es/AST_inboundEXTstats.php b/LANG_admin/LANG_admin/astguiclient_es/AST_inboundEXTstats.php new file mode 100644 index 0000000..29225ac --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/AST_inboundEXTstats.php @@ -0,0 +1,369 @@ + + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Estadística de Llamadas Entrantes\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Un NÚMERO Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Estadística de Llamadas Entrantes                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Llamadas totales que vinieron en este número:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+echo "| CALLERID   | CALLERIDNAME    | LENGTH | DATE TIME           |\n";
+echo "+------------+-----------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '$query_date 00:00:01' and start_time <= '$query_date 23:59:59' and server_ip='$server_ip' and extension='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-10s", $row[0]);
+	$CIDname =		sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+------------+-----------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and server_ip='$server_ip' and extension='$group' and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LLAMADAS TOTALES\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_es/admin.php b/LANG_admin/LANG_admin/astguiclient_es/admin.php new file mode 100644 index 0000000..505218d --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/admin.php @@ -0,0 +1,1627 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha salido. Gracias\n"; + exit; +} + +$STARTtime = date("U"); +$STARTdate = date("Y-m-d H:i:s"); + +if ($ADD==1) {$process = 'NUEVO TELÉFONO';} +if ($ADD==11) {$process = 'NUEVO SERVIDOR';} +if ($ADD==111) {$process = 'NUEVA CONFERENCIA';} +if ($ADD==2) {$process = 'CREANDO TELÉFONO';} +if ($ADD==21) {$process = 'CREANDO SERVIDOR';} +if ($ADD==211) {$process = 'CREANDO CONFERENCIA';} +if ($ADD==3) {$process = 'MODIFICAR EL TELÉFONO';} +if ($ADD==31) {$process = 'MODIFICAR EL SERVIDOR';} +if ($ADD==311) {$process = 'MODIFICAR LA CONFERENCIA';} +if ($ADD==4) {$process = 'MODIFICANDO EL TELÉFONO';} +if ($ADD==41) {$process = 'MODIFICANDO EL SERVIDOR';} +if ($ADD==411) {$process = 'MODIFICANDO LA CONFERENCIA';} +if ($ADD==5) {$process = 'DELETE PHONE';} +if ($ADD==6) {$process = 'DELETE PHONE';} +if ($ADD==55) {$process = 'BUSCAR TELÉFONOS';} +if ($ADD==66) {$process = 'BUSCAR TELÉFONOS RESULTS';} +if ($ADD==0) {$process = 'LISTA DE TELÉFONOS';} +if ($ADD==10) {$process = 'LISTA DE SERVIDORES';} +if ($ADD==100) {$process = 'LISTA DE CONFERENCIAS';} +if ($ADD==99999) {$process = 'AYUDA';} + + $stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status='ADMIN';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if ($auth<1) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > '6' and ast_admin_access='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGdelete_phones =$row[17]; + } + } + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + echo "|$stmt|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + if (strlen($LOGfullname) < 1) + { + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); + +$NWB = "   \"AYUDA\""; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "ASTERISK ADMIN: Administración - $process \n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
ASTERISK ADMIN: AYUDA


\n"; + +?> +TABLA DE LOS TELÉFONOS

+ +
+Extensión del teléfono - este campo es donde usted pone los nombres del teléfono que aparecen al marcar con asterisco no incluyendo el protocolo o la barra vertical del principio. Por ejemplo: para el teléfono SIP/test101 del SIP la extensión del teléfono sería test101. También, para los teléfonos IAX2 compruebe que usted utiliza el nombre del teléfono completo: IAX2/IAXphone1@IAXphone1 sería IAXphone1@IAXphone1. Para zap los teléfonos compruebe que usted pone el canal completo: Zap/25-1 sería 25-1. Otra nota, compruebe que usted fija el protocolo abajo correctamente para su tipo de teléfono. + +
+
+
+Número del Dialplan - este campo está para el número que usted marca para tener el anillo del teléfono. Este número se define en el archivo de extensions.conf de su servidor asterisco + +
+
+
+Caja de Buzón de Voz - este campo es para la caja del buzón de voz donde van los mensajes para al usuario de este teléfono. Utilizamos esto para comprobar los mensajes del buzón de voz y para que el usuario pueda acceder al Buzón de Voz desde astGUIclient. + +
+
+
+CallerID de salida - este campo es donde usted incorporara el número del callerID que usted quiera que aparezca en las llamadas de salida. Esto no funciona en las líneas RTB(non-PRI) T1/E1. + +
+
+
+Dirección IP del teléfono - este campo es para la dirección IP del teléfono si es un teléfono de VOZIP. Este es un campo opcional + +
+
+
+Dirección IP del ordenador - este campo es para la dirección IP del ordenador del usuario. Es un campo opcional + +
+
+
+IP del servidor - Este menú es donde usted selecciona en que servidor está el teléfono activo. + +
+
+
+Login - El nombre de usuario del teléfono para conseguir los permisos de admin. + +
+
+
+Contraseña - la contraseña usada por el usuario del teléfono para conseguir los permisos de admin. + +
+
+
+Estado - el estado del teléfono en el sistema, puede ser ACTIVO y ADMIN permiten que los clientes del GUI trabajen. ADMIN permite el acceso a este Web site de administración. El resto de los estados no permiten el acceso al GUI o al Web de Admin. + +
+
+
+Cuenta activa - si el teléfono está activado ponerla en la lista del cliente del GUI. + +
+
+
+Tipo de teléfono - solamente para información administrativas. + +
+
+
+Nombre completo - usado por el GUIclient en la lista de teléfonos activos. + +
+
+
+Compañía - solamente para las notas administrativas. + +
+
+
+Cuadro - todavía no puesto en ejecución. + +
+
+
+Nuevos mensajes - número de los nuevos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco. + +
+
+
+Viejos mensajes - número de los viejos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco. + +
+
+
+Protocolo del cliente - el protocolo que el teléfono utiliza para conectar con el servidor del asterisco: El Sip, IAX2, Zap. También, para los números External remotos o los números SpeedDial que usted desea enumerar como teléfonos. + +
+
+
+GMT local - La diferencia a partir del tiempo malo del ZULÚ del time(or de Greenwich) donde se localiza el teléfono. NO AJUSTE POR TIEMPO DE LOS AHORROS DE LA LUZ DEL DÃA. Esto es utilizada por la campaña de VICIDIAL para exhibir exactamente el tiempo y el tiempo del cliente. + +
+
+
+Conexión del encargado - Ésta es la conexión que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor. + +
+
+
+Secreto del encargado - Ésta es la contraseña que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor. + +
+
+
+Usuario del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo del usuario de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún usuario. + +
+
+
+Paso del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la contraseña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún paso. + +
+
+
+Campaña del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la campaña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ninguna campaña. + +
+
+
+Parque Exten - Ésta es la extensión del estacionamiento del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Extensión de la conferencia - Ésta es la extensión del parque de la conferencia del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Parque Exten de VICIDIAL - Ésta es la extensión del estacionamiento del defecto para el cliente app de VICIDIAL. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Archivo del parque de VICIDIAL - éste es el nombre del archivo de la extensión del parque del defecto VICIDIAL para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie éste limitado a 10 caracteres. + +
+
+
+Prefijo del monitor - éste es el prefijo dialplan para supervisar de zap los canales automáticamente dentro del app astGUIclient. Cambie solamente según los expedientes de extensiones de extensions.conf ZapBarge. + +
+
+
+Grabación Exten - Ésta es la extensión dialplan para la extensión de la grabación que se utiliza para caer en conferencias del meetme para registrarlas. Dura generalmente hasta que una hora si no parada verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+VMAIL Exten principal - Ésta es la extensión dialplan que va a comprobar su voicemail. verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+Descarga Exten de VMAIL - éste es el prefijo dialplan usado para enviar llamadas directamente al voicemail de un usuario de una llamada viva en el app. astGUIclient verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+Contexto de Exten - éste es el contexto dialplan que este teléfono utiliza sobre todo. Se asume que todos los números marcados por los apps del cliente están utilizando este contexto así que es una buena idea cerciorarse de que éste es el contexto más amplio posible verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+DTMF envían el canal - Ésta es la secuencia del canal usada para enviar sonidos de DTMF en conferencias del meetme de los apps del cliente. Verifique que exten y contexto con el archivo de extensions.conf. + +
+
+
+Grupo de salida de la llamada - éste es el grupo de canal que las llamadas de salida de este teléfono están puestas de. Hay rutinas de un par en los apps del cliente que utilizan esto. Para zap los canales que usted desea utilizar algo como Zap/g2, porque los troncos IAX2 usted desearía utilizar el prefijo completo de IAX como IAX2/VICItest1:secret@10.10.10.15:4569. Verifique que los troncos con el file(it de extensions.conf sean generalmente lo que usted ha definido como la variable global del TRUNK en la tapa del archivo). + +
+
+
+Localización del browser - esto es aplicable solamente a los clientes de UNIX/LINUX, el camino absoluto a Mozilla o el browser de Firefox en la máquina verifica esto lanzándolo manualmente. + +
+
+
+Instale el directorio - éste es el lugar en donde las escrituras astGUIclient y de astVICIDIAL están situadas en su máquina. Para Win32 debe ser algo como C:\AST_VICI y para UNIX debe ser algo como /usr/local/perl_TK. verifica esto manualmente. + +
+
+
+URL de CallerID - Ústa es la dirección de la tela de la página usada para hacer operaciones de búsqueda de encargo del callerID que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+URL del defecto de VICIDIAL - Ésta es la dirección de la tela de la página usada para hacer preguntas de encargo de la forma del Web de VICIDIAL que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Registración de la llamada - esto se fija para verdad si el archivo de call_log.agi está en lugar en el archivo de extensions.conf para todo el de salida y las extensiones del retraso ' h ' para registrar todo llama. Ústa debe siempre ser 1 porque es manditory para muchos astGUIclient y características de VICIDIAL a trabajar correctamente. + +
+
+
+Conmutación del usuario - fije para verdad para permitir que el usuario cambie a otra cuenta del usuario. NOTA: Si los interruptores del usuario ellos pueden iniciar la grabación en la conversación de teléfono del nuevo usuario + +
+
+
+Comunicación - fije para verdad para permitir que el usuario comience llamadas de conferencia con hasta que seis líneas externas. + +
+
+
+Retraso del Admin - sistema a verdad para permitir que el usuario pueda al retraso cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. + +
+
+
+Secuestro del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados. + +
+
+
+Monitor del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados y como herramienta del entrenamiento. + +
+
+
+Parque de llamada - el sistema a verdad para permitir que el usuario pueda parquear invita el asimiento astGUIclient para ser tomado por cualquier otro usuario astGUIclient en el sistema. Las llamadas permanecen en el asimiento para hasta que un retraso de la media-hora entonces. Permitido generalmente para todos. + +
+
+
+Cheque de Updater - fije para verdad para exhibir una advertencia del popup que el tiempo del updater no ha cambiado en 20 segundos. Útil para los usuarios del Admin. + +
+
+
+Af que registra - fije para verdad para registrar muchas acciones del uso astGUIclient a un archivo de texto en la computadora del usuario. + +
+
+
+La coleta permitió - al sistema verdad para hacer que los apps del cliente utilicen el sistema central de la coleta del asterisco. Requerido para VICIDIAL y recomendado para todos los usuarios. + +
+
+
+Ventana emergente del CallerID - sistema a verdad para tener en cuenta los números definidos en el archivo de extensions.conf para enviar las pantallas del popup de CallerID a los usuarios astGUIclient. + +
+
+
+Botón de VMail - fije para verdad para exhibir el botón de VOICEMAIL y los mensajes cuentan la exhibición en astGUIclient. + +
+
+
+Rápido restaure - fije para verdad para permitir un nuevo índice de restauran de la información de la llamada para el astGUIclient. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número. + +
+
+
+Rápido restaure la tarifa - en milisegundos. Utilizado solamente si es rápido restaure se permite. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número. + +
+
+
+Persistant MySQL - si está permitida la conexión astGUIclient seguirá conectada en vez de conectar cada segundo. Útil si usted hace que un rápido restaure la tarifa fijada. Aumentará el número de conexiones en su máquina de MySQL. + +
+
+
+Número siguiente del dial auto - si está permitido el cliente de VICIDIAL marcará el número siguiente en la lista automáticamente sobre la disposición de una llamada a menos que seleccionaran "para parar el marcar" en la pantalla de la disposición. + +
+
+
+Pare Rec después de cada llamada - si está permitido el cliente de VICIDIAL parará se está encendiendo cualquier grabación después de que haya sido cada llamada dispositioned. Útil si usted está haciendo muchos de la grabación o usted están utilizando una forma de la tela para accionar la grabación. + +
+
+
+Servidor de DBX - el servidor de la base de datos de MySQL con el cual este usuario debe conectar. + +
+
+
+Base de datos de DBX - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco. + +
+
+
+Usuario de DBX - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron. + +
+
+
+Paso de DBX - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234. + +
+
+
+DBX viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306. + +
+
+
+Servidor de DBY - el servidor de la base de datos de MySQL con el cual este usuario debe conectar. Secundario server, no utilizado actualmente. + +
+
+
+Base de datos de DBY - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco. Secundario server, no utilizado actualmente. + +
+
+
+Usuario de DBY - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron. Secundario server, no utilizado actualmente. + +
+
+
+Paso de DBY - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234. Secundario server, no utilizado actualmente. + +
+
+
+DBY viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306. Secundario server, no utilizado actualmente. + + +



+ +TABLA DE LOS SERVIDORES

+
+
+ID Del Servidor - Este campo es donde usted pone el nombre del servidor del asterisco, no tiene que ser un submarino oficial del dominio, apenas un apodo para identificar el servidor a los usuarios del Admin. + +
+
+
+Descripción del servidor - el campo donde usted utiliza una frase pequeña para describir el servidor del asterisco. + +
+
+
+IP address del servidor - el campo donde usted puso el IP address de la red del servidor del asterisco. + +
+
+
+Activo - fije si el servidor del asterisco es activo o inactivo. + +
+
+
+Versión del asterisco - fije la versión del asterisco que usted ha instalado en este servidor. Ejemplos: ' 1.2 ', ' 1.0.8 ', ' 1.0.7 ', ' CVS_HEAD ', ' REALMENTE VIEJO ', etc... Se utiliza esto porque las versiones 1.0.8 y 1.0.9 tienen un diverso método de ocuparse del insecto local del channels(a que ha estado fijado en CVS v1.0) y necesidad de ser tratado diferentemente cuando la manipulación de su Local/ acanala. También, CVS_HEAD actual y las 1.2 aplicaciones diverso encargado y comando del árbol del lanzamiento hicieron salir así que debe ser tratado diverso también. + +
+
+
+Troncos máximos de VICIDIAL - este campo determinará el número de las líneas máximo que el auto-dialer de VICIDIAL procurará invitar este servidor. Si usted desea dedicar dos PRI llenos T1 a VICIDIALing en un servidor entonces usted fijaría esto a 46. E1 defecto es 96. + +
+
+
+Anfitrión del telnet - éste es la dirección o el nombre del servidor del asterisco y es cómo los usos del encargado conectan con él de donde están funcionando. Si están funcionando en el servidor del asterisco, después el defecto del ' localhost ' está muy bien. + +
+
+
+El telnet vira hacia el lado de babor - éste es el puerto de la conexión del encargado del servidor del asterisco y es cómo los usos del encargado conectan con ella de donde están funcionando. El defecto de ' 5038 ' está para un estándar instala muy bien. + +
+
+
+Usuario del encargado - el username o la conexión conectaba genericly con el encargado del servidor del asterisco. El defecto es 'cron' + +
+
+
+Secreto del encargado - el secreto o la contraseña conectaba genericly con el encargado del servidor del asterisco. El defecto es '1234' + +
+
+
+Usuario en modo actualización del encargado - el username o la conexión conectaba con el encargado del servidor del asterisco optimizado para las escrituras de la actualización. Omita es 'updatecron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El encargado escucha usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que esperan a escuchar solamente salida. Omita es 'listencron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El encargado envía a usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que envían solamente acciones al encargado. Omita es 'sendcron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El GMT del servidor compensó - la diferencia sobre horas a partir del tiempo del GMT no ajustado según el Luz del di'a-Ahorro-Tiempo del servidor. El defecto es '-5' + +
+
+
+Descarga Exten - el prefijo de VMail de la extensión usado en este servidor para enviar llamadas directamente a través de agc a una caja específica del voicemail. El defecto es '85026666666666' + +
+
+
+Extensión del ANUNCIO de VICIDIAL - la extensión del defecto si ninguno está presente en la campaña enviar llamadas para a marcar auto de VICIDIAL. El defecto es '8365' + +
+
+
+Contexto del defecto - el contexto dialplan del defecto usado para las escrituras que funcionan para este servidor. El defecto es 'defecto' + + +



+ +TABLA DE CONFERENCIAS

+
+
+Número de la conferencia - este campo es donde usted pone el número del dialpna de la conferencia del meetme. También se recomienda que el número del meetme en meetme.conf empareja este número para cada entrada. Esto está para las conferencias en astGUIclient y se utiliza para la funcionalidad de leave-3way-call en VICIDIAL. + +
+
+
+IP del servidor - El menú donde usted selecciona el servidor del asterisco que esta conferencia estará encendido. + + + + + + +







+







+EL EXTREMO +
+ + + +ASTERISK ADMIN: Administración - <? echo $process ?> + + + +
+ + + + + + +
  ASTERISK ADMIN - Salir  
  ENUMERE TODOS LOS TELÉFONOS | AGREGUE Un TELÉFONO NUEVO | BÚSQUEDA PARA Un TELÉFONO | AGREGUE Un SERVIDOR | ENUMERE TODOS LOS SERVIDORES
  DEMUESTRE TODAS LAS CONFERENCIAS | AGREGUE Una NUEVA CONFERENCIA
+"; + +echo "
AGREGUE Un TELÉFONO NUEVO
\n"; +echo "\n"; +echo "
\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Extensión del teléfono: $NWB#phones-extension$NWE
Número De Dialplan: (Solamente dígitos)$NWB#phones-dialplan_number$NWE
Buzón de voz: (Solamente dígitos)$NWB#phones-voicemail_id$NWE
CallerID De salida: (Solamente dígitos)$NWB#phones-outbound_cid$NWE
Dirección IP del teléfono: (optional)$NWB#phones-phone_ip$NWE
Dirección IP del ordenador: (optional)$NWB#phones-computer_ip$NWE
IP Del Servidor: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Contraseña: $NWB#phones-pass$NWE
Estado: $NWB#phones-status$NWE
Cuenta Activa: $NWB#phones-active$NWE
Tipo Del Teléfono: $NWB#phones-phone_type$NWE
Nombre Completo: $NWB#phones-fullname$NWE
Compañía: $NWB#phones-company$NWE
Foto: $NWB#phones-picture$NWE
Protocolo Del Cliente: $NWB#phones-protocol$NWE
GMT Local: (No ajustar para el DST)$NWB#phones-local_gmt$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW SERVERS FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
AGREGAR Un SERVIDOR NUEVO\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Del Servidor: $NWB#servers-server_id$NWE
Descripción Del Servidor: $NWB#servers-server_description$NWE
Dirección IP del Servidor: $NWB#servers-server_ip$NWE
Activo: $NWB#servers-active$NWE
Versión De Asterisk: $NWB#servers-asterisk_version$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW CONFERENCES FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
AGREGUE Una NUEVA CONFERENCIA\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Número de la Conferencia: (Solamente dígitos)$NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
\n"; + +} + + +###################### +# ADD=2 adds the new phone to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
TELÉFONO NO AGREGADO - hay ya un teléfono en el sistema con esta extensión/servidor\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELÉFONO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
EL TELÉFONO AGREGÚ\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new server to the system +###################### + +if ($ADD==21) +{ + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVIDOR NO AGREGADO - hay ya un servidor en el sistema con esta identificación\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVIDOR NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
SERVIDOR AGREGADO\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new conference to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCIA NO AGREGADA - hay ya una conferencia en el sistema con esta identificación y servidor\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCIA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
LA CONFERENCIA AGREGÚ\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=100; +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of phone +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGdelete_phones < 1) ) + { + echo "
TELÉFONO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL TELÉFONO: $extension - $server_ip\n"; + echo "

Chasque aquí para suprimir el teléfono $extension - $server_ip


\n"; + } + +$ADD='3'; # go to phone modification below +} + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete phone record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGdelete_phones < 1) ) + { + echo "
TELÉFONO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DEL TELÉFONO TERMINÓ: $extension - $server_ip\n"; + echo "

\n"; + } + +$ADD='0'; # go to phone list +} + + + + + + +###################### +# ADD=3 modify phone info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICANDO EL TELÉFONO: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Extensión del teléfono: $NWB#phones-extension$NWE
Número De Dialplan: (Solamente dígitos)$NWB#phones-dialplan_number$NWE
Buzón de voz: (Solamente dígitos)$NWB#phones-voicemail_id$NWE
CallerID De salida: (Solamente dígitos)$NWB#phones-outbound_cid$NWE
Dirección IP del teléfono: (optional)$NWB#phones-phone_ip$NWE
Dirección IP del ordenador: (optional)$NWB#phones-computer_ip$NWE
IP Del Servidor: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Contraseña: $NWB#phones-pass$NWE
Estado: $NWB#phones-status$NWE
Cuenta Activa: $NWB#phones-active$NWE
Tipo Del Teléfono: $NWB#phones-phone_type$NWE
Nombre Completo: $NWB#phones-fullname$NWE
Compañía: $NWB#phones-company$NWE
Foto: $NWB#phones-picture$NWE
Mensajes Nuevos: $row[14]$NWB#phones-messages$NWE
Mensajes Viejos: $row[15]$NWB#phones-old_messages$NWE
Protocolo Del Cliente: $NWB#phones-protocol$NWE
GMT Local: (No ajustar para el DST)$NWB#phones-local_gmt$NWE
Login del Manager: $NWB#phones-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#phones-ASTmgrSECRET$NWE
Usuario por defecto de VICIDIAL: $NWB#phones-login_user$NWE
Contraseña por defecto de VICIDIAL: $NWB#phones-login_pass$NWE
Campaña por defecto de VICIDIAL: $NWB#phones-login_campaign$NWE
Extensión del parking: $NWB#phones-park_on_extension$NWE
Extensión de la conferencia: $NWB#phones-conf_on_extension$NWE
VICIDIAL Extensión del parking: $NWB#phones-VICIDIAL_park_on_extension$NWE
Archivo para música del parking de VICIDIAL: $NWB#phones-VICIDIAL_park_on_filename$NWE
Prefijo al monitorizar: $NWB#phones-monitor_prefix$NWE
Exten de Grabación: $NWB#phones-recording_exten$NWE
Exten de VmailMain: $NWB#phones-voicemail_exten$NWE
Exten de VmaiDumpl: $NWB#phones-voicemail_dump_exten$NWE
Contexto De Exten: $NWB#phones-ext_context$NWE
Canal de envío del DTMF: $NWB#phones-dtmf_send_extension$NWE
Grupo de las llamadas de salida: $NWB#phones-call_out_number_group$NWE
Localización del Navegador: $NWB#phones-client_browser$NWE
Directorio de instalación: $NWB#phones-install_directory$NWE
URL del CallerID: $NWB#phones-local_web_callerID_URL$NWE
URL por defecto de VICIDIAL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
Cambio de Usuario: $NWB#phones-user_switching_enabled$NWE
Conferencias: $NWB#phones-conferencing_enabled$NWE
Colgar del Admin: $NWB#phones-admin_hangup_enabled$NWE
Captura del Admin: $NWB#phones-admin_hijack_enabled$NWE
Monitorización del Admin: $NWB#phones-admin_monitor_enabled$NWE
Parking de Llamada: $NWB#phones-call_parking_enabled$NWE
Uptader Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Colas permitidas: $NWB#phones-QUEUE_ACTION_enabled$NWE
Ventana emergente del CallerID: $NWB#phones-CallerID_popup_enabled$NWE
Botón Vmail: $NWB#phones-voicemail_button_enabled$NWE
Refresco rápido: $NWB#phones-enable_fast_refresh$NWE
Refresco rápido Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Marcar el Siguiente Número: $NWB#phones-auto_dial_next_number$NWE
Parar de Grabar después de cada llamada: $NWB#phones-VDstop_rec_after_each_call$NWE
Servidor de DBX: (Primario DB Server)$NWB#phones-DBX_server$NWE
Base de datos de DBX: (Primario Server Database)$NWB#phones-DBX_database$NWE
Usuario de DBX: (Primario DB Login)$NWB#phones-DBX_user$NWE
Contraseña de DBX: (Primario DB Secret)$NWB#phones-DBX_pass$NWE
Puerto de DBX: (Primario DB Port)$NWB#phones-DBX_port$NWE
Servidor de DBY: (Secundario DB Server)$NWB#phones-DBY_server$NWE
Base de datos de DBY: (Secundario Server Database)$NWB#phones-DBY_database$NWE
Usuario de DBY: (Secundario DB Login)$NWB#phones-DBY_user$NWE
Contraseña de DBY: (Secundario DB Secret)$NWB#phones-DBY_pass$NWE
Puerto de DBY: (Secundario DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Pinchar aquí­ para ver las estadísticas del teléfono\n"; + +if ($LOGdelete_phones > 0) + { + echo "

SUPRIMA ESTE TELÉFONO\n"; + } + +} + + +###################### +# ADD=31 modify server info in the system +###################### + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICAR UN REGISTRO DEL SERVIDOR: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Del Servidor: $NWB#servers-server_id$NWE
Descripción Del Servidor: $NWB#servers-server_description$NWE
Dirección IP del Servidor: $NWB#servers-server_ip$NWE
Activo: $NWB#servers-active$NWE
Versión De Asterisk: $NWB#servers-asterisk_version$NWE
Máx. Trunks en VICIDIAL: $NWB#servers-max_vicidial_trunks$NWE
Host Del Telnet: $NWB#servers-telnet_host$NWE
Puerto Del Telnet: $NWB#servers-telnet_port$NWE
Usuario Del Manager: $NWB#servers-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#servers-ASTmgrSECRET$NWE
Usuario del Updater del Manager: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Usuario Listen del Manager: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Usuario Send del Manager: $NWB#servers-ASTmgrUSERNAMEsend$NWE
GMT Local: (No ajustar para el DST)$NWB#servers-local_gmt$NWE
Extensión de Vmail Dump : $NWB#servers-voicemail_dump_exten$NWE
Extensión del AD de VICIDIAL: $NWB#servers-answer_transfer_agent$NWE
Contexto por Defecto: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
TELÉFONOS DENTRO DE ESTE SERVIDOR:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIÓNNOMBREACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Este servidor tiene $active_lists Teléfonos activos y $inactive_lists Teléfonos inactivos

\n"; +echo "
\n"; +} + + +###################### +# ADD=311 modify conference info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICAR UN REGISTRO DE LA CONFERENCIA: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conferencia: $NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
Extensión Actual:
\n"; + +echo "
\n"; + +} + + + +###################### +# ADD=4 submit phone modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
TELÉFONO NO MODIFICADO - hay ya un teléfono en el sistema con esta extensión/servidor\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELÉFONO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
TELÉFONO MODIFICADO: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='$local_web_callerID_URL', VICIDIAL_web_URL='$VICIDIAL_web_URL', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICANDO EL TELÉFONO: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Extensión del teléfono: $NWB#phones-extension$NWE
Número De Dialplan: (Solamente dígitos)$NWB#phones-dialplan_number$NWE
Buzón de voz: (Solamente dígitos)$NWB#phones-voicemail_id$NWE
CallerID De salida: (Solamente dígitos)$NWB#phones-outbound_cid$NWE
Dirección IP del teléfono: (optional)$NWB#phones-phone_ip$NWE
Dirección IP del ordenador: (optional)$NWB#phones-computer_ip$NWE
IP Del Servidor: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Contraseña: $NWB#phones-pass$NWE
Estado: $NWB#phones-status$NWE
Cuenta Activa: $NWB#phones-active$NWE
Tipo Del Teléfono: $NWB#phones-phone_type$NWE
Nombre Completo: $NWB#phones-fullname$NWE
Compañía: $NWB#phones-company$NWE
Foto: $NWB#phones-picture$NWE
Mensajes Nuevos: $row[14]$NWB#phones-messages$NWE
Mensajes Viejos: $row[15]$NWB#phones-old_messages$NWE
Protocolo Del Cliente: $NWB#phones-protocol$NWE
GMT Local: (No ajustar para el DST)$NWB#phones-local_gmt$NWE
Login del Manager: $NWB#phones-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#phones-ASTmgrSECRET$NWE
Usuario por defecto de VICIDIAL: $NWB#phones-login_user$NWE
Contraseña por defecto de VICIDIAL: $NWB#phones-login_pass$NWE
Campaña por defecto de VICIDIAL: $NWB#phones-login_campaign$NWE
Extensión del parking: $NWB#phones-park_on_extension$NWE
Extensión de la conferencia: $NWB#phones-conf_on_extension$NWE
VICIDIAL Extensión del parking: $NWB#phones-VICIDIAL_park_on_extension$NWE
Archivo para música del parking de VICIDIAL: $NWB#phones-VICIDIAL_park_on_filename$NWE
Prefijo al monitorizar: $NWB#phones-monitor_prefix$NWE
Exten de Grabación: $NWB#phones-recording_exten$NWE
Exten de VmailMain: $NWB#phones-voicemail_exten$NWE
Exten de VmaiDumpl: $NWB#phones-voicemail_dump_exten$NWE
Contexto De Exten: $NWB#phones-ext_context$NWE
Canal de envío del DTMF: $NWB#phones-dtmf_send_extension$NWE
Grupo de las llamadas de salida: $NWB#phones-call_out_number_group$NWE
Localización del Navegador: $NWB#phones-client_browser$NWE
Directorio de instalación: $NWB#phones-install_directory$NWE
URL del CallerID: $NWB#phones-local_web_callerID_URL$NWE
URL por defecto de VICIDIAL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
Cambio de Usuario: $NWB#phones-user_switching_enabled$NWE
Conferencias: $NWB#phones-conferencing_enabled$NWE
Colgar del Admin: $NWB#phones-admin_hangup_enabled$NWE
Captura del Admin: $NWB#phones-admin_hijack_enabled$NWE
Monitorización del Admin: $NWB#phones-admin_monitor_enabled$NWE
Parking de Llamada: $NWB#phones-call_parking_enabled$NWE
Uptader Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Colas permitidas: $NWB#phones-QUEUE_ACTION_enabled$NWE
Ventana emergente del CallerID: $NWB#phones-CallerID_popup_enabled$NWE
Botón Vmail: $NWB#phones-voicemail_button_enabled$NWE
Refresco rápido: $NWB#phones-enable_fast_refresh$NWE
Refresco rápido Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Marcar el Siguiente Número: $NWB#phones-auto_dial_next_number$NWE
Parar de Grabar después de cada llamada: $NWB#phones-VDstop_rec_after_each_call$NWE
Servidor de DBX: (Primario DB Server)$NWB#phones-DBX_server$NWE
Base de datos de DBX: (Primario Server Database)$NWB#phones-DBX_database$NWE
Usuario de DBX: (Primario DB Login)$NWB#phones-DBX_user$NWE
Contraseña de DBX: (Primario DB Secret)$NWB#phones-DBX_pass$NWE
Puerto de DBX: (Primario DB Port)$NWB#phones-DBX_port$NWE
Servidor de DBY: (Secundario DB Server)$NWB#phones-DBY_server$NWE
Base de datos de DBY: (Secundario Server Database)$NWB#phones-DBY_database$NWE
Usuario de DBY: (Secundario DB Login)$NWB#phones-DBY_user$NWE
Contraseña de DBY: (Secundario DB Secret)$NWB#phones-DBY_pass$NWE
Puerto de DBY: (Secundario DB Port)$NWB#phones-DBY_port$NWE
\n"; + +echo "

Pinchar aquí­ para ver las estadísticas del teléfono\n"; + +if ($LOGdelete_phones > 0) + { + echo "

SUPRIMA ESTE TELÉFONO\n"; + } + +} + +###################### +# ADD=41 submit server modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVIDOR NO MODIFICADO - hay ya un servidor en el sistema con este server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVIDOR NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
SERVIDOR MODIFICADO: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + + $stmt="SELECT * from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICAR UN REGISTRO DEL SERVIDOR: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Del Servidor: $NWB#servers-server_id$NWE
Descripción Del Servidor: $NWB#servers-server_description$NWE
Dirección IP del Servidor: $NWB#servers-server_ip$NWE
Activo: $NWB#servers-active$NWE
Versión De Asterisk: $NWB#servers-asterisk_version$NWE
Máx. Trunks en VICIDIAL: $NWB#servers-max_vicidial_trunks$NWE
Host Del Telnet: $NWB#servers-telnet_host$NWE
Puerto Del Telnet: $NWB#servers-telnet_port$NWE
Usuario Del Manager: $NWB#servers-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#servers-ASTmgrSECRET$NWE
Usuario del Updater del Manager: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Usuario Listen del Manager: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Usuario Send del Manager: $NWB#servers-ASTmgrUSERNAMEsend$NWE
GMT Local: (No ajustar para el DST)$NWB#servers-local_gmt$NWE
Extensión de Vmail Dump : $NWB#servers-voicemail_dump_exten$NWE
Extensión del AD de VICIDIAL: $NWB#servers-answer_transfer_agent$NWE
Contexto por Defecto: $NWB#servers-ext_context$NWE
\n"; + +echo "
\n"; +echo "
TELÉFONOS DENTRO DE ESTE SERVIDOR:
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
EXTENSIÓNNOMBREACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Este servidor tiene $active_lists Teléfonos activos y $inactive_lists Teléfonos inactivos

\n"; +echo "
\n"; + +} + +###################### +# ADD=411 submit conference modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCIA - hay ya una conferencia en el sistema con esta extensión - servidor NO MODIFICADO\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCIA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
CONFERENCIA MODIFICADA: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + + $stmt="SELECT * from conferences where conf_exten='$conf_exten';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + +echo "
MODIFICAR UN REGISTRO DE LA CONFERENCIA: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conferencia: $NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
Extensión Actual:
\n"; + +echo "
\n"; + +} + + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
BÚSQUEDA PARA Un TELÉFONO\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Extensión:
Nombre Completo:
Phone type:
\n"; + +} + +###################### +# ADD=66 phone search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($extension) {$SQL .= "user LIKE \"%$extension%\" and";} + if ($fullname) {$SQL .= "fullname LIKE \"%$fullname%\" and";} + if ($phone_type) {$SQL .= "phone_type LIKE \"%$phone_type%\" and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from phones $SQL order by extension,server_ip;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
RESULTADOS DE LA BÚSQUEDA:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFICAR | ESTADÃSTICAS
\n"; + +} + + + +###################### +# ADD=0 display all active phones +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from phones order by extension,server_ip"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DE TELÉFONOS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFICAR | ESTADÃSTICAS
\n"; +} + +###################### +# ADD=10 display all servers +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DEL SERVIDOR:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFICAR
\n"; +} + + +###################### +# ADD=100 display all conferences +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DE CONFERENCIAS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFICAR
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_es/dbconnect.php b/LANG_admin/LANG_admin/astguiclient_es/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/astguiclient_es/help.gif b/LANG_admin/LANG_admin/astguiclient_es/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/astguiclient_es/help.gif differ diff --git a/LANG_admin/LANG_admin/astguiclient_es/htglobalize.php b/LANG_admin/LANG_admin/astguiclient_es/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/astguiclient_es/inbound_popup.php b/LANG_admin/LANG_admin/astguiclient_es/inbound_popup.php new file mode 100644 index 0000000..9ad5ee9 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/inbound_popup.php @@ -0,0 +1,194 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK SALIENTES REMOTOS: Popup + + +
+ + 0) +{ + + $stmt="DELETE from parked_channels where server_ip='$user_server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$user_server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Vuelva a dirigir el comando enviado para el canal $channel       $NOW_TIME\n

\n"; + + + $url = 'https://10.10.10.15/internal/back_end_systems/cust_serv/index.php?Search=SEARCH&'; + $Suser = 'username='; + $Spass = '&passwd='; + $Sphone = '&phone='; + + $newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW$Sphone$phone"; + if ( ($phone == 'unknown') or (strlen($phone)<9) ) + {$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW";} + + echo "Mire para arriba a este cliente en sistema del servicio de cliente\n

\n"; + + echo "Cierre esta ventana\n

\n"; +} +else +{ + echo "Vuelva a dirigir el comando FALLADO para el canal $channel       $NOW_TIME\n

\n"; + echo "Cierre esta ventana\n

\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_es/phone_stats.php b/LANG_admin/LANG_admin/astguiclient_es/phone_stats.php new file mode 100644 index 0000000..6e880b6 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/phone_stats.php @@ -0,0 +1,228 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ASTERISK ADMIN: Estadísticas Del Teléfono + + +
+
+ + + + + + +\n"; +echo "
  ASTERISK ADMIN: Administración  
  ENUMERE TODOS LOS TELÉFONOS | AGREGUE Un TELÉFONO NUEVO | BÚSQUEDA PARA Un TELÉFONO | AGREGUE Un SERVIDOR | ENUMERE TODOS LOS SERVIDORES
  DEMUESTRE TODAS LAS CONFERENCIAS | AGREGUE Una NUEVA CONFERENCIA
  \n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "TIEMPO DE LLAMADA Y CANALES:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
GRUPO DE CANALES CUENTA HORAS:MINUTOS
$row[1] $row[0] $call_hours_int:$call_minutes_int
LLAMADAS TOTALES $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LLAMADAS DEL ÚLTIMO 1000 PARA LA GAMA DE LA FECHA:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
NÚMERO GRUPO DE CANALES FECHA LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/astguiclient_es/remote_inbound.php b/LANG_admin/LANG_admin/astguiclient_es/remote_inbound.php new file mode 100644 index 0000000..69ead48 --- /dev/null +++ b/LANG_admin/LANG_admin/astguiclient_es/remote_inbound.php @@ -0,0 +1,165 @@ +0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $rowx[0]; + $dialplan_number = $rowx[1]; + $user_server_ip = $rowx[2]; + if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";} + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + echo"\n"; + echo"ASTERISK ENTRANTES REMOTOS: Principal\n"; + echo"\n"; + echo"\n"; + echo"\n"; + +?> + + +
+ +
\n"; + +echo "Chasque encendido el canal debajo de ése que usted quisiera haber dirigido a su teléfono

\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME        \n";
+echo "----------------------------------------------------------------------------------------------\n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' order by parked_time";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$user_server_ip' and channel_group LIKE \"IN_%\" order by parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$extension =		sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		echo "$channel$server$channel_group$extension$parked_by$parked_time\n";
+
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "*************************************** NO PARKED CALLS **************************************\n";
+	echo "**********************************************************************************************\n";
+	echo "**********************************************************************************************\n";
+	}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/install_server_files.pl b/LANG_admin/LANG_admin/install_server_files.pl new file mode 100644 index 0000000..970ef4c --- /dev/null +++ b/LANG_admin/LANG_admin/install_server_files.pl @@ -0,0 +1,426 @@ +#!/usr/bin/perl + +############################################ +# install_server_files.pl - puts server files in the right places +# +# modify the variables below to customize for your system. +# +# path to home directory: (assumes it already exists) +$home = '/home/cron'; + +# path to agi-bin directory: (assumes it already exists) +$agibin = '/var/lib/asterisk/agi-bin'; + +# path to web root directory: (assumes it already exists) +$webroot = '/home/www/htdocs'; +#$webroot = '/usr/local/apache2/htdocs'; + +# path to asterisk sounds directory: (assumes it already exists) +$sounds = '/var/lib/asterisk/sounds'; + +# path to asterisk recordings directory: (assumes it already exists) +$monitor = '/var/spool/asterisk'; + +############################################ + +$secX = time(); + +# constants +$DB=1; # Debug flag, set to 0 for no debug messages, lots of output +$US='_'; +$MT[0]=''; +$LANG_FILE='./languages.txt'; +$LANG_FILE_ADMIN='./languages_admin.txt'; + +### 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 [-t] = test\n [-debug] = verbose debug messages\n[--language-web-build] = build only the multi-language client files\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--language-web-build/i) + { + $LANG=1; + print "\n----- LANGUAGE WEB SCRIPT ONLY BUILD -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +if ($LANG) +{ +open(lang, "$LANG_FILE_ADMIN") || die "can't open $LANG_FILE_ADMIN: $!\n"; +@lang = ; +close(lang); + &translate_pages; + +@lang=@MT; +@LANGUAGES=@MT; +@FILES=@MT; +@TRANSLATIONS=@MT; + +open(lang, "$LANG_FILE") || die "can't open $LANG_FILE: $!\n"; +@lang = ; +close(lang); + &translate_pages; + +} + +else +{ +print "INSTALLING SERVER SIDE COMPONENTS...\n"; + +print "Creating cron/LOGS directory...\n"; +`mkdir $home/LOGS/`; + +print "setting LOGS directory to executable...\n"; +`chmod 0766 $home/LOGS`; + +print "Creating $home/VICIDIAL/LEADS_IN/DONE directory...\n"; +`mkdir $home/VICIDIAL`; +`mkdir $home/VICIDIAL/LEADS_IN`; +`mkdir $home/VICIDIAL/LEADS_IN/DONE`; +`chmod -R 0766 $home/VICIDIAL`; + +print "Creating $monitor directories...\n"; +`mkdir $monitor/monitor`; +`mkdir $monitor/monitor/ORIG`; +`mkdir $monitor/monitor/DONE`; +`chmod -R 0766 $monitor/monitor`; + +print "Copying cron scripts...\n"; +`cp -f ./ADMIN_adjust_GMTnow_on_leads.pl $home/`; +`cp -f ./ADMIN_area_code_populate.pl $home/`; +`cp -f ./ADMIN_keepalive_AST_send_listen.pl $home/`; +`cp -f ./ADMIN_keepalive_send_listen.at $home/`; +`cp -f ./ADMIN_keepalive_AST_update.pl $home/`; +`cp -f ./ADMIN_keepalive_AST_VDautodial.pl $home/`; +`cp -f ./ADMIN_keepalive_AST_VDremote_agents.pl $home/`; +`cp -f ./ADMIN_restart_roll_logs.pl $home/`; +`cp -f ./AST_conf_update.pl $home/`; +`cp -f ./AST_CRON_mix_recordings.pl $home/`; +`cp -f ./AST_CRON_mix_recordings_BASIC.pl $home/`; +`cp -f ./AST_DB_optimize.pl $home/`; +`cp -f ./AST_flush_DBqueue.pl $home/`; +`cp -f ./AST_manager_kill_hung_congested.pl $home/`; +`cp -f ./AST_manager_listen.pl $home/`; +`cp -f ./AST_manager_send.pl $home/`; +`cp -f ./AST_reset_mysql_vars.pl $home/`; +`cp -f ./AST_send_action_child.pl $home/`; +`cp -f ./AST_SERVER_conf.pl $home/`; +`cp -f ./AST_update.pl $home/`; +`cp -f ./AST_VDauto_dial.pl $home/`; +`cp -f ./AST_VDhopper.pl $home/`; +`cp -f ./AST_VDremote_agents.pl $home/`; +`cp -f ./AST_vm_update.pl $home/`; +`cp -f ./phone_codes_GMT.txt $home/`; +`cp -f ./start_asterisk_boot.pl $home/`; +`cp -f ./VICIDIAL_IN_new_leads_file.pl $home/`; +`cp -f ./test_VICIDIAL_lead_file.txt $home/VICIDIAL/LEADS_IN/`; + + +print "setting cron scripts to executable...\n"; +`chmod 0755 $home/*`; + +print "Copying agi-bin scripts...\n"; +`cp -f ./agi-dtmf.agi $agibin/`; +`cp -f ./agi-VDADtransfer.agi $agibin/`; +`cp -f ./agi-VDADcloser.agi $agibin/`; +`cp -f ./agi-VDADcloser_inbound.agi $agibin/`; +`cp -f ./agi-VDADcloser_inboundANI.agi $agibin/`; +`cp -f ./agi-VDADcloser_inboundCID.agi $agibin/`; +`cp -f ./agi-VDADcloser_inbound_NOCID.agi $agibin/`; +`cp -f ./agi-VDADcloser_inbound_5ID.agi $agibin/`; +`cp -f ./call_inbound.agi $agibin/`; +`cp -f ./call_log.agi $agibin/`; +`cp -f ./call_logCID.agi $agibin/`; +`cp -f ./call_park.agi $agibin/`; +`cp -f ./call_park_EXT.agi $agibin/`; +`cp -f ./call_park_I.agi $agibin/`; +`cp -f ./call_park_L.agi $agibin/`; +`cp -f ./call_park_W.agi $agibin/`; +`cp -f ./debug_speak.agi $agibin/`; +`cp -f ./invalid_speak.agi $agibin/`; + + +print "setting agi-bin scripts to executable...\n"; +`chmod 0755 $agibin/*`; + +print "Copying sounds...\n"; +`cp -f ./DTMF_sounds/* $sounds/`; + +print "Creating vicidial web directory...\n"; +`mkdir $webroot/vicidial/`; +`mkdir $webroot/vicidial/ploticus/`; + +print "Copying VICIDIALweb php files...\n"; +`cp -f ./VICIDIAL_web/* $webroot/vicidial/`; + +print "setting VICIDIALweb scripts to executable...\n"; +`chmod 0755 -R $webroot/vicidial/`; +`chmod 0777 $webroot/vicidial/`; +`chmod 0777 $webroot/vicidial/ploticus/`; + +print "Creating agc web directory...\n"; +`mkdir $webroot/agc/`; + +print "Copying agc php files...\n"; +`cp -R -f ./agc/* $webroot/agc/`; + +print "setting agc scripts to executable...\n"; +`chmod 0755 -R $webroot/agc/`; +`chmod 0777 $webroot/agc/`; + +print "Creating astguiclient web directory...\n"; +`mkdir $webroot/astguiclient/`; + +print "Copying astguiclient web php files...\n"; +`cp -f ./astguiclient_web/* $webroot/astguiclient/`; + +print "setting astguiclient web scripts to executable...\n"; +`chmod 0755 -R $webroot/astguiclient/`; +`chmod 0777 $webroot/astguiclient/`; + +} + + + +$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far +print "\n - process runtime ($secz sec) ($minz minutes)\n"; +print "\n\nDONE and EXITING\n"; + + +exit; + + + +sub translate_pages +{ +#***LANGUAGES*** +#en-English|es-Espaol|fr|de|it| +#***FILES*** +#agc/astguiclient.php +#agc/vicidial.php +#***TRANSLATIONS*** +#English|Ingls|Anglais|Englisch|Inglese| +#Spanish|Espaol|||| + +##### PARSE THE LANGUAGES SETTING FILE ##### +$section=''; +$i=0; +$Lct=0; $Fct=0; $Tct=0; +foreach(@lang) + { + if ($lang[$i] !~ /^\#/) + { + if ($lang[$i] =~ /^\*\*\*/) + { + $section = $lang[$i]; + $section =~ s/\*|\n|\r//gi; + # print "section heading: $section: $lang[$i]"; + } + else + { + if ($section =~ /LANGUAGES/) + { + $LANGUAGES = $lang[$i]; + $Lct++; + } + else + { + if ($section =~ /FILES/) + { + # print "section: $section line: $lang[$i]"; + $FILES[$Fct] = $lang[$i]; + $Fct++; + } + else + { + if ($section =~ /TRANSLATIONS/) + { + # print "section: $section line: $lang[$i]"; + $TRANSLATIONS[$Tct] = $lang[$i]; + $Tct++; + } + } + } + } + } + $i++; + } + +if ($DB) + { + print "LANGUAGE FILE PARSE RESULTS: $#lang lines in file\n"; + print "LANGUAGES: $LANGUAGES\n"; + print "FILES: $Fct\n"; + print "TRANSLATIONS: $Tct\n"; + } + +##### LOOP THROUGH THE LANGUAGES && ($lang_list[$i] !~ /^en/) ) +@lang_list = split(/\|/, $LANGUAGES); +@lang_link_list = @lang_list; +$i=0; +$gif = '.gif'; +foreach(@lang_list) + { + if (length($lang_list[$i]) > 2) + { + @lang_detail = split(/-/, $lang_list[$i]); + $lang_abb = $lang_detail[0]; + $lang_name = $lang_detail[1]; + + ##### LOOP THROUGH THE FILES + $Fct=0; + foreach(@FILES) + { + $a=0; + @file_detail = split(/\|/, $FILES[$Fct]); + $file_path = $file_detail[0]; + $file_name = $file_detail[1]; + $file_name =~ s/\t|\r|\n//gi; + $file_passthru = $file_detail[2]; + $file_passthru =~ s/\t|\r|\n//gi; + if (-e "$webroot/$file_path/$file_name") + { + open(file, "$webroot/$file_path/$file_name") || die "can't open $webroot/$file_path/$file_name: $!\n"; + @file = @MT; + @file = ; + close(file); + + print "File exists: ./$file_path/$file_name\n"; + if (-e "$webroot/$file_path$US$lang_abb") + { + print "Lang Directory exists: $webroot/$file_path$US$lang_abb\n"; + } + else + { + `mkdir $webroot/$file_path$US$lang_abb`; + `chmod 0777 $webroot/$file_path$US$lang_abb`; + print "Lang Directory created: $webroot/$file_path$US$lang_abb\n"; + } + + if ($file_passthru < 1) + { + ##### LOOP THROUGH THE TRANSLATIONS + $Tct=0; + foreach(@TRANSLATIONS) + { + @TRANSline = split(/\|/, $TRANSLATIONS[$Tct]); + $ORIGtext = "$TRANSline[0]"; + $TRANStext = "$TRANSline[$i]"; + $LINESct=0; + foreach(@file) + { + if ($file[$LINESct] !~ /^\#|^\s*function |'INCALL'|'PAUSED'|'READY'|'NEW'|xmlhttp|ILPV |ILPA |SELECT cmd_line_f/) + { + if ($file[$LINESct] =~ /INTERNATIONALIZATION-LINKS-PLACEHOLDER-VICIDIAL/) + { + $file[$LINESct] =~ s/INTERNATIONALIZATION-LINKS-PLACEHOLDER-VICIDIAL/ILPV/g; + $e=0; + $gif = '.gif'; + foreach(@lang_link_list) + { + if (length($lang_link_list[$e]) > 2) + { + @lang_list_detail = split(/-/, $lang_link_list[$e]); + $lang_list_abb = $lang_list_detail[0]; + $lang_list_name = $lang_list_detail[1]; + if ($lang_list_abb =~ /$lang_abb/) {$list_bgcolor = ' BGCOLOR=\"#CCFFCC\"';} + else {$list_bgcolor = '';} + $file[$LINESct] .= "echo \"
\\n\";"; + } + $e++; + } + } + else + { + if ($file[$LINESct] =~ /INTERNATIONALIZATION-LINKS-PLACEHOLDER-AGC/) + { + $file[$LINESct] =~ s/INTERNATIONALIZATION-LINKS-PLACEHOLDER-AGC/ILPA/g; + $e=0; + $gif = '.gif'; + foreach(@lang_link_list) + { + if (length($lang_link_list[$e]) > 2) + { + @lang_list_detail = split(/-/, $lang_link_list[$e]); + $lang_list_abb = $lang_list_detail[0]; + $lang_list_name = $lang_list_detail[1]; + if ($lang_list_abb =~ /$lang_abb/) {$list_bgcolor = ' BGCOLOR=\"#CCFFCC\"';} + else {$list_bgcolor = '';} + $file[$LINESct] .= "echo \"\\n\";"; + } + $e++; + } + } + else + { + if ( ($lang_abb =~ /^en/) && ($Tct > 2) ) + { + $file[$LINESct] =~ s/\.\/images\//\.\.\/agc\/images\//g; + $file[$LINESct] =~ s/\"help.gif/\"..\/astguiclient\/help.gif/g; + } + if ($lang_abb !~ /^en/) + {$file[$LINESct] =~ s/$ORIGtext/$TRANStext/g;} + } + } + } + $LINESct++; + + if ($a =~ /00000$/i) {print "$a $file[$LINESct]\n|$ORIGtext|$TRANStext|";} + $a++; + } + $Tct++; + } + } + ### open the translation result file for writing ### + open(out, ">$webroot/$file_path$US$lang_abb/$file_name") + || die "Can't open $webroot/$file_path$US$lang_abb/$file_name: $!\n"; + # print out "Header(\"Content-type: text/html; charset=utf-8\");\n"; + $LINESct=0; + foreach(@file) + { + print out "$file[$LINESct]"; + $LINESct++; + } + close(out); + print "\n"; + print "File Written: $webroot/$file_path$US$lang_abb/$file_name\n"; + } + else + { + print "File does not exist: $webroot/$file_path/$file_name\n"; + } + $Fct++; + } + + } + $i++; + } + +} \ No newline at end of file diff --git a/LANG_admin/LANG_admin/languages.txt b/LANG_admin/LANG_admin/languages.txt new file mode 100644 index 0000000..bc84acb --- /dev/null +++ b/LANG_admin/LANG_admin/languages.txt @@ -0,0 +1,358 @@ +# languages.txt - this file is for the internationalization of the astGUIclient +# client web pages. The associated config.pl file will take the language as an +# argument and alter the php scripts to the language typed in the command line: +# example: ./config.pl --language=es +# current languages in the file: +# - English - (en) no alterations +# - Spanish - (es) first column +# - French - (fr) second column +# - German - (de) third column +# - Italian - (it) fourth column +***LANGUAGES*** +en-English|es-Español|fr-Français|de-Deutsch|it-Italiano|pt-Português|el-Ελληνικά| +***FILES*** +agc|astguiclient.php|0 +agc|vicidial.php|0 +agc|vdc_db_query.php|0 +agc|manager_send.php|0 +agc|conf_exten_check.php|0 +agc|inbound_popup.php|0 +agc|active_list_refresh.php|0 +agc|park_calls_display.php|0 +agc|live_exten_check.php|0 +agc|call_log_display.php|0 +agc|voicemail_check.php|0 +agc|dbconnect.php|1 +agc|htglobalize.php|1 +***TRANSLATIONS*** +English|Inglés|Anglais|Englisch|Inglese|Inglês|Αγγλικά||| +Spanish|Español|Espagnol|Spanisch|Spagnolo|Espanhol|Ισπανικά||| +French|Francés|Français|Französisch|Francese|Francês|Γαλλικά||| +German|Alemán|Allemand|Deutsch|Tedesco|Alemão|ΓεÏμανικά||| +Italian|Italiano|Italien|Italienisch|Italiano|Italiano|Ιταλικά||| +agc_check_voicemail_BLINK.gif|agc_check_voicemail_BLINK_es.gif|agc_check_voicemail_BLINK_fr.gif|agc_check_voicemail_BLINK_de.gif|agc_check_voicemail_BLINK_it.gif|agc_check_voicemail_BLINK_pt.gif|agc_check_voicemail_BLINK_el.gif||| +agc_check_voicemail_OFF.gif|agc_check_voicemail_OFF_es.gif|agc_check_voicemail_OFF_fr.gif|agc_check_voicemail_OFF_de.gif|agc_check_voicemail_OFF_it.gif|agc_check_voicemail_OFF_pt.gif|agc_check_voicemail_OFF_el.gif||| +agc_check_voicemail_ON.gif|agc_check_voicemail_ON_es.gif|agc_check_voicemail_ON_fr.gif|agc_check_voicemail_ON_de.gif|agc_check_voicemail_ON_it.gif|agc_check_voicemail_ON_pt.gif|agc_check_voicemail_ON_el.gif||| +agc_live_call_OFF.gif|agc_live_call_OFF_es.gif|agc_live_call_OFF_fr.gif|agc_live_call_OFF_de.gif|agc_live_call_OFF_it.gif|agc_live_call_OFF_pt.gif|agc_live_call_OFF_el.gif||| +agc_live_call_ON.gif|agc_live_call_ON_es.gif|agc_live_call_ON_fr.gif|agc_live_call_ON_de.gif|agc_live_call_ON_it.gif|agc_live_call_ON_pt.gif|agc_live_call_ON_el.gif||| +agc_tab_active_lines.gif|agc_tab_active_lines_es.gif|agc_tab_active_lines_fr.gif|agc_tab_active_lines_de.gif|agc_tab_active_lines_it.gif|agc_tab_active_lines_pt.gif|agc_tab_active_lines_el.gif||| +agc_tab_conferences.gif|agc_tab_conferences_es.gif|agc_tab_conferences_fr.gif|agc_tab_conferences_de.gif|agc_tab_conferences_it.gif|agc_tab_conferences_pt.gif|agc_tab_conferences_el.gif||| +agc_tab_main.gif|agc_tab_main_es.gif|agc_tab_main_fr.gif|agc_tab_main_de.gif|agc_tab_main_it.gif|agc_tab_main_pt.gif|agc_tab_main_el.gif||| +vdc_LB_dialnextnumber.gif|vdc_LB_dialnextnumber_es.gif|vdc_LB_dialnextnumber_fr.gif|vdc_LB_dialnextnumber_de.gif|vdc_LB_dialnextnumber_it.gif|vdc_LB_dialnextnumber_pt.gif|vdc_LB_dialnextnumber_el.gif||| +vdc_LB_dialnextnumber_OFF.gif|vdc_LB_dialnextnumber_OFF_es.gif|vdc_LB_dialnextnumber_OFF_fr.gif|vdc_LB_dialnextnumber_OFF_de.gif|vdc_LB_dialnextnumber_OFF_it.gif|vdc_LB_dialnextnumber_OFF_pt.gif|vdc_LB_dialnextnumber_OFF_el.gif||| +vdc_LB_grabparkedcall.gif|vdc_LB_grabparkedcall_es.gif|vdc_LB_grabparkedcall_fr.gif|vdc_LB_grabparkedcall_de.gif|vdc_LB_grabparkedcall_it.gif|vdc_LB_grabparkedcall_pt.gif|vdc_LB_grabparkedcall_el.gif||| +vdc_LB_hangupcustomer.gif|vdc_LB_hangupcustomer_es.gif|vdc_LB_hangupcustomer_fr.gif|vdc_LB_hangupcustomer_de.gif|vdc_LB_hangupcustomer_it.gif|vdc_LB_hangupcustomer_pt.gif|vdc_LB_hangupcustomer_el.gif||| +vdc_LB_hangupcustomer_OFF.gif|vdc_LB_hangupcustomer_OFF_es.gif|vdc_LB_hangupcustomer_OFF_fr.gif|vdc_LB_hangupcustomer_OFF_de.gif|vdc_LB_hangupcustomer_OFF_it.gif|vdc_LB_hangupcustomer_OFF_pt.gif|vdc_LB_hangupcustomer_OFF_el.gif||| +vdc_LB_parkcall.gif|vdc_LB_parkcall_es.gif|vdc_LB_parkcall_fr.gif|vdc_LB_parkcall_de.gif|vdc_LB_parkcall_it.gif|vdc_LB_parkcall_pt.gif|vdc_LB_parkcall_el.gif||| +vdc_LB_parkcall_OFF.gif|vdc_LB_parkcall_OFF_es.gif|vdc_LB_parkcall_OFF_fr.gif|vdc_LB_parkcall_OFF_de.gif|vdc_LB_parkcall_OFF_it.gif|vdc_LB_parkcall_OFF_pt.gif|vdc_LB_parkcall_OFF_el.gif||| +vdc_LB_pause.gif|vdc_LB_pause_es.gif|vdc_LB_pause_fr.gif|vdc_LB_pause_de.gif|vdc_LB_pause_it.gif|vdc_LB_pause_pt.gif|vdc_LB_pause_el.gif||| +vdc_LB_pause_OFF.gif|vdc_LB_pause_OFF_es.gif|vdc_LB_pause_OFF_fr.gif|vdc_LB_pause_OFF_de.gif|vdc_LB_pause_OFF_it.gif|vdc_LB_pause_OFF_pt.gif|vdc_LB_pause_OFF_el.gif||| +vdc_LB_resume.gif|vdc_LB_resume_es.gif|vdc_LB_resume_fr.gif|vdc_LB_resume_de.gif|vdc_LB_resume_it.gif|vdc_LB_resume_pt.gif|vdc_LB_resume_el.gif||| +vdc_LB_resume_OFF.gif|vdc_LB_resume_OFF_es.gif|vdc_LB_resume_OFF_fr.gif|vdc_LB_resume_OFF_de.gif|vdc_LB_resume_OFF_it.gif|vdc_LB_resume_OFF_pt.gif|vdc_LB_resume_OFF_el.gif||| +vdc_LB_startrecording.gif|vdc_LB_startrecording_es.gif|vdc_LB_startrecording_fr.gif|vdc_LB_startrecording_de.gif|vdc_LB_startrecording_it.gif|vdc_LB_startrecording_pt.gif|vdc_LB_startrecording_el.gif||| +vdc_LB_stoprecording.gif|vdc_LB_stoprecording_es.gif|vdc_LB_stoprecording_fr.gif|vdc_LB_stoprecording_de.gif|vdc_LB_stoprecording_it.gif|vdc_LB_stoprecording_pt.gif|vdc_LB_stoprecording_el.gif||| +vdc_LB_transferconf.gif|vdc_LB_transferconf_es.gif|vdc_LB_transferconf_fr.gif|vdc_LB_transferconf_de.gif|vdc_LB_transferconf_it.gif|vdc_LB_transferconf_pt.gif|vdc_LB_transferconf_el.gif||| +vdc_LB_transferconf_OFF.gif|vdc_LB_transferconf_OFF_es.gif|vdc_LB_transferconf_OFF_fr.gif|vdc_LB_transferconf_OFF_de.gif|vdc_LB_transferconf_OFF_it.gif|vdc_LB_transferconf_OFF_pt.gif|vdc_LB_transferconf_OFF_el.gif||| +vdc_LB_webform.gif|vdc_LB_webform_es.gif|vdc_LB_webform_fr.gif|vdc_LB_webform_de.gif|vdc_LB_webform_it.gif|vdc_LB_webform_pt.gif|vdc_LB_webform_el.gif||| +vdc_LB_webform_OFF.gif|vdc_LB_webform_OFF_es.gif|vdc_LB_webform_OFF_fr.gif|vdc_LB_webform_OFF_de.gif|vdc_LB_webform_OFF_it.gif|vdc_LB_webform_OFF_pt.gif|vdc_LB_webform_OFF_el.gif||| +vdc_XB_blindtransfer.gif|vdc_XB_blindtransfer_es.gif|vdc_XB_blindtransfer_fr.gif|vdc_XB_blindtransfer_de.gif|vdc_XB_blindtransfer_it.gif|vdc_XB_blindtransfer_pt.gif|vdc_XB_blindtransfer_el.gif||| +vdc_XB_blindtransfer_OFF.gif|vdc_XB_blindtransfer_OFF_es.gif|vdc_XB_blindtransfer_OFF_fr.gif|vdc_XB_blindtransfer_OFF_de.gif|vdc_XB_blindtransfer_OFF_it.gif|vdc_XB_blindtransfer_OFF_pt.gif|vdc_XB_blindtransfer_OFF_el.gif||| +vdc_XB_dialwithcustomer.gif|vdc_XB_dialwithcustomer_es.gif|vdc_XB_dialwithcustomer_fr.gif|vdc_XB_dialwithcustomer_de.gif|vdc_XB_dialwithcustomer_it.gif|vdc_XB_dialwithcustomer_pt.gif|vdc_XB_dialwithcustomer_el.gif||| +vdc_XB_dialwithcustomer_OFF.gif|vdc_XB_dialwithcustomer_OFF_es.gif|vdc_XB_dialwithcustomer_OFF_fr.gif|vdc_XB_dialwithcustomer_OFF_de.gif|vdc_XB_dialwithcustomer_OFF_it.gif|vdc_XB_dialwithcustomer_OFF_pt.gif|vdc_XB_dialwithcustomer_OFF_el.gif||| +vdc_XB_hangupbothlines.gif|vdc_XB_hangupbothlines_es.gif|vdc_XB_hangupbothlines_fr.gif|vdc_XB_hangupbothlines_de.gif|vdc_XB_hangupbothlines_it.gif|vdc_XB_hangupbothlines_pt.gif|vdc_XB_hangupbothlines_el.gif||| +vdc_XB_hangupbothlines_OFF.gif|vdc_XB_hangupbothlines_OFF_es.gif|vdc_XB_hangupbothlines_OFF_fr.gif|vdc_XB_hangupbothlines_OFF_de.gif|vdc_XB_hangupbothlines_OFF_it.gif|vdc_XB_hangupbothlines_OFF_pt.gif|vdc_XB_hangupbothlines_OFF_el.gif||| +vdc_XB_hangupxferline.gif|vdc_XB_hangupxferline_es.gif|vdc_XB_hangupxferline_fr.gif|vdc_XB_hangupxferline_de.gif|vdc_XB_hangupxferline_it.gif|vdc_XB_hangupxferline_pt.gif|vdc_XB_hangupxferline_el.gif||| +vdc_XB_hangupxferline_OFF.gif|vdc_XB_hangupxferline_OFF_es.gif|vdc_XB_hangupxferline_OFF_fr.gif|vdc_XB_hangupxferline_OFF_de.gif|vdc_XB_hangupxferline_OFF_it.gif|vdc_XB_hangupxferline_OFF_pt.gif|vdc_XB_hangupxferline_OFF_el.gif||| +vdc_XB_internalcloser.gif|vdc_XB_internalcloser_es.gif|vdc_XB_internalcloser_fr.gif|vdc_XB_internalcloser_de.gif|vdc_XB_internalcloser_it.gif|vdc_XB_internalcloser_pt.gif|vdc_XB_internalcloser_el.gif||| +vdc_XB_internalcloser_OFF.gif|vdc_XB_internalcloser_OFF_es.gif|vdc_XB_internalcloser_OFF_fr.gif|vdc_XB_internalcloser_OFF_de.gif|vdc_XB_internalcloser_OFF_it.gif|vdc_XB_internalcloser_OFF_pt.gif|vdc_XB_internalcloser_OFF_el.gif||| +vdc_XB_leave3waycall.gif|vdc_XB_leave3waycall_es.gif|vdc_XB_leave3waycall_fr.gif|vdc_XB_leave3waycall_de.gif|vdc_XB_leave3waycall_it.gif|vdc_XB_leave3waycall_pt.gif|vdc_XB_leave3waycall_el.gif||| +vdc_XB_leave3waycall_OFF.gif|vdc_XB_leave3waycall_OFF_es.gif|vdc_XB_leave3waycall_OFF_fr.gif|vdc_XB_leave3waycall_OFF_de.gif|vdc_XB_leave3waycall_OFF_it.gif|vdc_XB_leave3waycall_OFF_pt.gif|vdc_XB_leave3waycall_OFF_el.gif||| +vdc_XB_localcloser.gif|vdc_XB_localcloser_es.gif|vdc_XB_localcloser_fr.gif|vdc_XB_localcloser_de.gif|vdc_XB_localcloser_it.gif|vdc_XB_localcloser_pt.gif|vdc_XB_localcloser_el.gif||| +vdc_XB_localcloser_OFF.gif|vdc_XB_localcloser_OFF_es.gif|vdc_XB_localcloser_OFF_fr.gif|vdc_XB_localcloser_OFF_de.gif|vdc_XB_localcloser_OFF_it.gif|vdc_XB_localcloser_OFF_pt.gif|vdc_XB_localcloser_OFF_el.gif||| +vdc_XB_parkcustomerdial.gif|vdc_XB_parkcustomerdial_es.gif|vdc_XB_parkcustomerdial_fr.gif|vdc_XB_parkcustomerdial_de.gif|vdc_XB_parkcustomerdial_it.gif|vdc_XB_parkcustomerdial_pt.gif|vdc_XB_parkcustomerdial_el.gif||| +vdc_XB_parkcustomerdial_OFF.gif|vdc_XB_parkcustomerdial_OFF_es.gif|vdc_XB_parkcustomerdial_OFF_fr.gif|vdc_XB_parkcustomerdial_OFF_de.gif|vdc_XB_parkcustomerdial_OFF_it.gif|vdc_XB_parkcustomerdial_OFF_pt.gif|vdc_XB_parkcustomerdial_OFF_el.gif||| +vdc_XB_hotkeysactive.gif|vdc_XB_hotkeysactive_es.gif|vdc_XB_hotkeysactive_fr.gif|vdc_XB_hotkeysactive_de.gif|vdc_XB_hotkeysactive_it.gif|vdc_XB_hotkeysactive_pt.gif|vdc_XB_hotkeysactive_el.gif||| +vdc_XB_hotkeysactive_OFF.gif|vdc_XB_hotkeysactive_OFF_es.gif|vdc_XB_hotkeysactive_OFF_fr.gif|vdc_XB_hotkeysactive_OFF_de.gif|vdc_XB_hotkeysactive_OFF_it.gif|vdc_XB_hotkeysactive_OFF_pt.gif|vdc_XB_hotkeysactive_OFF_el.gif||| +vdc_LB_senddtmf.gif|vdc_LB_senddtmf_es.gif|vdc_LB_senddtmf_fr.gif|vdc_LB_senddtmf_de.gif|vdc_LB_senddtmf_it.gif|vdc_LB_senddtmf_pt.gif|vdc_LB_senddtmf_el.gif||| +vdc_LB_senddtmf_OFF.gif|vdc_LB_senddtmf_OFF_es.gif|vdc_LB_senddtmf_OFF_fr.gif|vdc_LB_senddtmf_OFF_de.gif|vdc_LB_senddtmf_OFF_it.gif|vdc_LB_senddtmf_OFF_pt.gif|vdc_LB_senddtmf_OFF_el.gif||| +vdc_XB_header.gif|vdc_XB_header_es.gif|vdc_XB_header_fr.gif|vdc_XB_header_de.gif|vdc_XB_header_it.gif|vdc_XB_header_pt.gif|vdc_XB_header_el.gif||| +vdc_XB_number.gif|vdc_XB_number_es.gif|vdc_XB_number_fr.gif|vdc_XB_number_de.gif|vdc_XB_number_it.gif|vdc_XB_number_pt.gif|vdc_XB_number_el.gif||| +vdc_XB_channel.gif|vdc_XB_channel_es.gif|vdc_XB_channel_fr.gif|vdc_XB_channel_de.gif|vdc_XB_channel_it.gif|vdc_XB_channel_pt.gif|vdc_XB_channel_el.gif||| +vdc_XB_seconds.gif|vdc_XB_seconds_es.gif|vdc_XB_seconds_fr.gif|vdc_XB_seconds_de.gif|vdc_XB_seconds_it.gif|vdc_XB_seconds_pt.gif|vdc_XB_seconds_el.gif||| +You have now logged out. Thank you|Usted ahora ha registrado hacia fuera. Gracias|Vous vous êtes maintenant déconnecté. Merci|Sie haben jetzt heraus geloggt. Danke|Ora avete annotato fuori. Grazie|Você tem registrado agora para fora. Obrigado|Έχετε αποσυνδεθεί τώÏα. Σας ευχαÏιστοÏμε||| +astGUIclient web-client VERSION|versión astGUIclient del tela-cliente|VERSION astGUIclient d'enchaînement-client|astGUIclient Netz-Klient VERSION|VERSIONE astGUIclient del fotoricettore-cliente|VERSÃO astGUIclient do correia-cliente|ΈΚΔΟΣΗ Ιστός-πελατών astGUIclient||| +astGUIclient web client|web client astGUIclient|web client astGUIclient|astGUIclient web client|web client astGUIclient|web client astGUIclient|astGUIclient πελάτης ΙστοÏ||| +VICIDIAL web client|web client VICIDIAL|Web client de VICIDIAL|VICIDIAL web client|Web client di VICIDIAL|Web client de VICIDIAL|VICIDIAL πελάτης ΙστοÏ||| +VICIDIAL web-client version|versión web client VICIDIAL|Version d'enchaînement-client de VICIDIAL|VICIDIAL Netz-Klient Version|Versione del fotoricettore-cliente di VICIDIAL|Versão do correia-cliente de VICIDIAL|Έκδοση Ιστός-πελατών VICIDIAL||| +You can only monitor Zap channels|Usted puede supervisa solamente Zap los canales|Vous pouvez surveillez seulement zap des canaux |Sie können überwachen nur Zap Führungen|Potete soltanto controllate zap le scanalature|Você pode monitora somente zap as canaletas|ΜποÏείτε μόνο να ελέγξετε τα κανάλια Zap||| +Stop Record|Pare la grabación|Arrêtez Le Disque|Stoppen Sie Aufzeichnung|Arresti L'Annotazione|Pare O Registro|ΑÏχείο στάσεων||| +you are logged into this phone|su teléfono|votre téléphone|Ihr Telefon|il vostro telefono|seu telefone|τηλέφωνο ||| +Back to Main Window|Volver a la pantalla principal|De nouveau à la fenêtre principale|Zurück zu Hauptfenster|Di nuovo alla finestra principale|Para trás à janela principal|Πίσω στο κÏÏιο παÏάθυÏο||| +LIVE CALLS ON THIS PHONE|LLAMADAS ACTIVAS EN ESTE TELÉFONO|DE PHASE INVITE CE TÉLÉPHONE|PHASEN ERSUCHT UM DIESES TELEFON|IN TENSIONE INVITA QUESTO TELEFONO|VIVO CONVIDA ESTE TELEFONE|ΖΗΣΤΕ ΚΑΛΕΙ ΑΥΤΟ ΤΟ ΤΗΛΕΦΩÎΟ||| +LIVE CALLS IN THIS CONFERENCE|LLAMADAS ACTIVAS EN ESTA CONFERENCIA|VIVENT LES APPELS DANS CETTE CONFÉRENCE|LEBEN ANRUFE IN DIESER KONFERENZ|VIVONO LE CHIAMATE IN QUESTO CONGRESSO|VIVEM AS CHAMADAS NCESTA CONFERÊNCIA|ΖΗΣΤΕ ΚΛΗΣΕΙΣ ΣΕ ΑΥΤΗΠΤΗΠΔΙΑΣΚΕΨΗ||| +LIVE CALL TRANSFER|TRANSFERIR LLAMADA ACTIVA|TRANSFERT DE PHASE D'APPEL|PHASENANRUF-ÜBERTRAGUNG|TRASFERIMENTO IN TENSIONE DI CHIAMATA|TRANSFERÊNCIA VIVA DA CHAMADA|ΖΗΣΤΕ ΜΕΤΑΦΟΡΑ ΚΛΗΣΗΣ||| +CLIENT CHANNEL|CANAL CLIENTE|LA MANCHE DE CLIENT|KLIENT FÜHRUNG|MANICA DEL CLIENTE|CANALETA DO CLIENTE|ΚΑÎΑΛΙ ΠΕΛΑΤΩÎ||| +REMOTE CHANNEL|CANAL REMOTO|LA MANCHE À DISTANCE|REMOTEFÜHRUNG|MANICA A DISTANZA|CANALETA REMOTA|ΜΑΚΡΙÎΟ ΚΑÎΑΛΙ||| +CLICK HERE TO LOG IN AGAIN|PINCHA AQUà PARA ENTRAR OTRA VEZ|CLIC ICI À L'OUVERTURE ENCORE|KLICKEN SIE HIER, UM INNEN WIEDER ZU LOGGEN|SCATTISI QUI PER ENTRARE ANCORA|ESTALE AQUI PARA LOGON OUTRA VEZ|ΧΤΥΠΗΣΤΕ ΕΔΩ ΓΙΑ ÎΑ ΚΑΤΑΓΡΑΨΕΤΕ ΠΑΛΙ||| +ACTIVE DISPLAY PAUSED|DISPLAY ACTIVO PAUSADO|L'AFFICHAGE ACTIF A FAIT UNE PAUSE|AKTIVE ANZEIGE PAUSIERTE|L'ESPOSIZIONE ATTIVA HA FATTO UNA PAUSA|A EXPOSIÇÃO ATIVA PAUSOU|Η ΕÎΕΡΓΟΣ ΕΠΙΔΕΙΞΗ ΣΤΑΜΑΤΗΣΕ||| +Main Panel|Pantalla Principal|Panneau Principal|Hauptverkleidung|Pannello Principale|Painel Principal|ΚÏÏια επιτÏοπή||| +Active Lines Panel|Pantalla Lineas Activas|Lignes Actives Panneau|Aktive Linien Verkleidung|Linee Attive Pannello|Linhas Ativas Painel|ΕνεÏγός επιτÏοπή γÏαμμών||| +Conferences Panel|Pantalla de Conferencias|Panneau De Conférences|Konferenz-Verkleidung|Pannello Di Congressi|Painel Das Conferências|ΕπιτÏοπή διασκέψεων||| +Check Voicemail|Comprobar buzón de voz|Vérifiez Voicemail|Überprüfen Sie Voicemail|Controlli Voicemail|Verifique Voicemail|Φωνητικό ταχυδÏομείο ελέγχου||| +Live Call|Llamada Activa|Vivent L'Appel|Leben Anruf|Vive La Chiamata|Vive A Chamada|Ζήστε κλήση||| +Hangup Trunk|Colgar Trunk|Tronc De Décrochement|Hängezustand-Stamm|Tronco Di Hangup|Tronco Do Hangup|ΚοÏμός Κλείστε το τηλέφωνο||| +Hijack Trunk|Capturar Trunk|Tronc De Détournement|Straßenräuber-Stamm|Tronco Di Dirottamento|Tronco Do Hijack|ΚοÏμός αεÏοπειÏατείας||| +Listen Trunk|Escuchar Trunk|Écoutent Le Tronc|Hören Stamm|Ascolta Il Tronco|Escuta O Tronco|ΑκοÏστε κοÏμός||| +Active Local Menu|Menú Local Activa|Menu Local Actif|Aktives Lokales Menü|Menu Locale Attivo|Menu Local Ativo|ΕνεÏγές τοπικές επιλογές||| +Hangup Local|Colgar Local|Gens du pays De Décrochement|Hängezustand-Einheimischer|Local Di Hangup|Local Do Hangup|Hangup τοπικό||| +Hijack Local|Capturar Local|Gens du pays De Détournement|Straßenräuber-Einheimischer|Local Di Dirottamento|Local Do Hijack|ΑεÏοπειÏατεία τοπική||| +Listen Local|Escuchar Local|Écoutent Les Gens du pays|Hören Einheimischer|Ascolta Il Local|Escuta O Local|ΑκοÏστε τοπικός||| +Channel to be transferred|Canal que va a ser transferido|La Manche à transférer|Gebracht zu werden Führung|Manica da trasferire|Canaleta a ser transferida|Κανάλι που μεταφέÏεται||| +Extensions Menu|Menú Extensiones|Menu De Prolongements|Verlängerungen Menü|Menu Di Estensioni|Menu Das Extensões|Επιλογές επεκτάσεων||| +Send to selected extension|Envíe a la extensión seleccionada|Envoyez à la prolongation choisie|Senden Sie zu vorgewählter Verlängerung|Trasmetta all'estensione selezionata|Emita à extensão selecionada|Στείλετε στην επιλεγμένη επέκταση||| +Send to selected vmail box|Enviar al buzón de voz seleccionada|Envoyez dans la boîte choisie de vmail|Senden Sie zu vorgewähltem vmail Kasten|Trasmetta alla scatola selezionata del vmail|Emita à caixa selecionada do vmail|Στείλετε στο επιλεγμένο vmail κιβώτιο||| +Send to this number|Envíe a este número|Envoyez à ce nombre|Senden Sie zu dieser Zahl|_ trasmett questo numero|Emita a este número|Στείλετε σε αυτόν τον αÏιθμό||| +click on a number below to send to a conference|Pinchar en un número de abajo para enviar a una conferencia|cliquez sur un nombre ci-dessous pour envoyer à une|klicken Sie an eine Zahl unten, um zu einer Konferenz zu senden|scatti sopra un numero qui sotto per trasmettere ad un congresso|estale sobre um número abaixo para emitir a uma conferência|χτυπήστε σε έναν αÏιθμό κατωτέÏω που στέλνει σε μια διάσκεψη||| +Send my channel too|Enviar mi canal también|Envoyez mon canal aussi|Senden Sie meine Führung auch|Trasmetta la mia scanalatura anche|Emita minha canaleta demasiado|Στείλετε το κανάλι μου επίσης||| +Conferences Menu|Menú de Conferencias|Menu De Conférences|Konferenz-Menü|Menu Di Congressi|Menu Das Conferências|Επιλογές διασκέψεων||| +LOCAL Extensions Dial|Marcar a Extensiones LOCALES|Cadran LOCAL De Prolongements|LOKALER Verlängerungen Vorwahlknopf|Manopola LOCALE Di Estensioni|Seletor LOCAL Das Extensões|ΤΟΠΙΚΟΣ πίνακας επεκτάσεων||| +Phone calling from|Teléfono llamando desde|Téléphone appelant de|Telefon, das von benennt|Telefono che denomina da|Telefone que chama-se de|Τηλέφωνο που καλεί από||| +Call selected extension|Llamar extensión seleccionada|Prolongation choisie par appel|Anruf vorgewählte Verlängerung|Estensione selezionata chiamata|Extensão selecionada chamada|Επιλεγμένη κλήση επέκταση||| +Call selected vmail box|Llamar buzón de voz seleccionado|Boîte de vmail choisie par appel|Anruf vorgewählter vmail Kasten|Scatola del vmail selezionata chiamata|Caixa selecionada chamada do vmail|Επιλεγμένο κλήση vmail κιβώτιο||| +LOCAL DIAL EXTENSIONS|MARCAR EXTENSIONES LOCALES|PROLONGEMENTS LOCAUX DE CADRAN|LOKALE VORWAHLKNOPF-VERLÄNGERUNGEN|ESTENSIONI LOCALI DELLA MANOPOLA|EXTENSÕES LOCAIS DO SELETOR|ΤΟΠΙΚΕΣ ΕΠΕΚΤΑΣΕΙΣ ΠΙÎΑΚΩÎ||| +OUTBOUND CALLS|LLAMADAS SALIENTES|APPELS EN PARTANCE|OUTBOUND ANRUFE|CHIAMATE OUTBOUND|CHAMADAS OUTBOUND |ΕΞΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ||| +INBOUND CALLS|LLAMADAS ENTRANTES|APPELS D'ARRIVÉE|INBOUND ANRUFE|CHIAMATE INBOUND|CHAMADAS INBOUND|ΕΙΣΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ||| +Refresh rate|Actualizar la tarifa|La vitesse de régénération|Erneuern Sie Rate|La velocità di rinfrescamento|Refresque a taxa|Αναζωογονήστε το ποσοστό||| +MANUAL DIAL|MARCADO MANUAL|CADRAN MANUEL|MANUELLER VORWAHLKNOPF|MANOPOLA MANUALE|SELETOR MANUAL|ΧΕΙΡΩÎΑΚΤΙΚΟΣ ΠΙÎΑΚΑΣ||| +CALL DATE/TIME|FECHA/HORA DE LA LLAMADA|DATE/HEURE D'APPEL|ANRUFDATE/TIME|DATE/TIME DI CHIAMATA|DATE/TIME DA CHAMADA|ΗΜΕΡΟΜΗÎΙΑ/ΧΡΟÎΟΣ ΚΛΗΣΗΣ||| +LOCAL HANGUP|Colgar Local|DÉCROCHEMENT LOCAL|LOKALER HÄNGEZUSTAND|HANGUP LOCALE|HANGUP LOCAL|ΤΟΠΙΚΟ ΚΛΕΙΣΤΕ ΤΟ ΤΗΛΈΦΩÎΟ||| +PARKED CALLS|LLAMADAS APARCADAS|APPELS GARÉS|GEPARKTE ANRUFE|CHIAMATE PARCHEGGIATE|CHAMADAS ESTACIONADAS|ΣΤΑΘΜΕΥΜΕÎΕΣ ΚΛΗΣΕΙΣ||| +PARKED BY|APARCAR POR|GARÉ PRÈS|VORBEI GEPARKT|PARCHEGGIATO VICINO|ESTACIONADO PERTO|ΣΤΑΘΜΕΥΜΕÎΟΣ ΚΟÎΤΑ||| +PARKED TIME|TIEMPO EN PARKING|TEMPS GARÉ|GEPARKTE ZEIT|TEMPO PARCHEGGIATO|TEMPO ESTACIONADO|ΣΤΑΘΜΕΥΜΕÎΟΣ ΧΡΟÎΟΣ||| +Registered to|Registrado a|Enregistré à|Registriert zu|Registrato a|Registado a|ΚαταχωÏημένος||| +Enter Conference|Entrar en la conferencia|Écrivez La Conférence|Tragen Sie Konferenz Ein|Entri Nel Congresso|Incorpore A Conferência|Εισάγετε τη διάσκεψη||| +Dial From Conf|Marcar desde la Conf|Cadran de conf |Vorwahlknopf Von Conf|Manopola Da Conf|Seletor De Conf|Πίνακας από τη διάσκεψη||| +Active Extensions|Extensiones Activas|Prolongements Actifs|Aktive Verlängerungen|Estensioni Attive|Extensões Ativas|ΕνεÏγές επεκτάσεις||| +Outside Lines|Líneas de salida|Lignes Extérieures|Äußere Linien|Linee Esterne|Linhas Exteriores|ΕξωτεÏικές γÏαμμές||| +Local Extensions|Extensiones Locales|Prolongements Locaux|Lokale Verlängerungen|Estensioni Locali|Extensões Locais|Τοπικές επεκτάσεις||| +Data Goes Here|Los Datos Van Aquí|Les Données Vont Ici|Daten Gehen Hier|I Dati Vanno Qui|Os Dados Vão Aqui|Το στοιχείο πηγαίνει εδώ||| +Trunk Action|Acciones en Trunk|Action De Tronc|Stamm-Tätigkeit|Azione Del Tronco|Ação Do Tronco|ΔÏάση κοÏμών||| +Local Action|Acción Local|Action Locale|Lokale Tätigkeit|Azione Locale|Ação Local|Τοπική δÏάση||| +Conferences List|Lista De las Conferencias|Liste De Conférences|Konferenz-Liste|Lista Di Congressi|Lista Das Conferências|Κατάλογος διασκέψεων||| +Click on a conference room number on the left for info on that conference|Pinchar a la izquierda del número de una sala de conferencias para obtener información|Cliquez sur un nombre de salle de conférence du côté gauche|Klicken Sie an Konferenzzimmernummer auf dem links für Info auf|Scatti sopra un numero di stanza di congresso a sinistra per l'Info su|Estale sobre um número de quarto da conferência na esquerda para o|Χτυπήστε σε έναν αÏιθμό δωματίων διασκέψεων στο αÏιστεÏÏŒ για τις πληÏοφοÏίες σε εκείνη την διάσκεψη||| +List Display|Mostrar Listas|Affichage De Liste|Liste Anzeige|Esposizione Della Lista|Exposição Da Lista|Επίδειξη καταλόγων||| +Live Extensions|Extensiones Activas|Prolongements De phase|Phasenverlängerungen|Estensioni In tensione|Extensões Vivas|Ζήστε επεκτάσεις||| +Busy Extensions|Extensiones Ocupadas|Prolongements Occupés|Beschäftigte Verlängerungen|Estensioni Occupate|Extensões Ocupadas|Πολυάσχολες επεκτάσεις||| +Outside Lines|Extensiones Salientes|Lignes Extérieures|Äußere Linien|Linee Esterne|Linhas Exteriores|ΕξωτεÏικές γÏαμμές||| +script runtime|tiempo de ejecución del Script|temps d'exécution de manuscrit|Indexlaufzeit|tempo di esecuzione dello scritto|runtime do certificado|χÏόνος εκτέλεσης χειÏογÏάφων||| +Call Log Display|Motrar el registro de llamadas|Affichage De Notation D'Appel|Anruf-Maschinenbordbuch-Anzeige|Esposizione Del Ceppo Di Chiamata|Exposição Do Registro Da Chamada|Επίδειξη κοÏτσουÏων κλήσης||| +is not valid|No es válido|est inadmissible|ist unzulässig|è non valido|é inválido|δεν ισχÏει||| +or protocol|o protocolo|ou protocole|oder Protokoll|o protocollo|ou protocolo|ή Ï€Ïωτόκολλο||| +Conf Extension Check|Comprobar la Extensión de Conf|Contrôle De Prolongation De Conf|Conf Verlängerung Überprüfung|Controllo Di Estensione Di Conf|Verificação Da Extensão De Conf|Έλεγχος επέκτασης διασκέψεων||| +has been registered to|Ha sido registrado para|a été enregistré à|ist zu registriert worden|è stato registrato a|foi registado a|έχει καταχωÏηθεί||| +LIVE INBOUND CALL|LLAMADA DE ENTRADA ACTIVA|APPEL D'ARRIVÉE DE PHASE|INBOUND LEBHAFTANRUF|CHIAMATA INBOUND IN TENSIONE|CHAMADA INBOUND VIVA|ΖΗΣΤΕ ΕΙΣΕΡΧΟΜΕÎΗ ΚΛΗΣΗ||| +Number Dialed|Número Marcado|Numéro Composé|Nummer Gewählt|Il Numero Ha composto|O Número Marcou|ΑÏιθμός που σχηματίζεται||| +SEND TO MY VOICEMAIL|ENVIAR A MI BUZÓN DE VOZ|ENVOYEZ À MON VOICEMAIL|SENDEN SIE ZU MEINEM VOICEMAIL|TRASMETTA AL MIO VOICEMAIL|EMITA A MEU VOICEMAIL|ΣΤΕΙΛΕΤΕ ΣΤΟ ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΊΟ ΜΟΥ||| +Live Extension Check|Comprobar Extensión Activa|Contrôle De phase De Prolongation|Phasenverlängerung Überprüfung|Controllo In tensione Di Estensione|Verificação Viva Da Extensão|Ζήστε έλεγχος επέκτασης||| +Manager Send|Enviar al Manager|Le Directeur Envoient|Manager Senden|Il Responsabile Trasmette|O Gerente Emite|Ο διευθυντής στέλνει||| +command not inserted|comando no insertado|commande non insérée|Befehl nicht eingesetzt|ordine non inserito|comando não introduzido|που δεν παÏεμβάλλεται εντολή||| +command sent for|comando enviado a|commande envoyée pour|Befehl gesendet für|ordine trasmesso per|comando emitido para|εντολή που στέλνεται για||| +One of these variables|Una de estas variables|Une de ces variables|Eine dieser Variablen|Una di queste variabili|Uma destas variáveis|Μια από αυτές τις μεταβλητές||| +must be greater than 2 characters|debe ser mayor de 2 caracteres|doivent être les 2 caractères plus grands que|muß als 2 Buchstaben grösser sein|deve essere più grande di 2 caratteri|deve ser mais grande de 2 caráteres|Ï€Ïέπει να είστε μεγαλÏτεÏος από 2 χαÏακτήÏες||| +must be greater than 14 characters|debe ser mayor de 14 caracteres|doivent être les 14 caractères plus grands que|muß als 14 Buchstaben grösser sein|deve essere più grande di 14 caratteri|deve ser mais grande de 14 caráteres|Ï€Ïέπει να είστε μεγαλÏτεÏος από 14 χαÏακτήÏες||| +must be set|debe ser fijado|doit être placé|muß eingestellt werden|deve essere regolato|deve ser ajustado|Ï€Ïέπει να τεθείτε||| +not sent|no enviado|non envoyé|nicht gesendet|non trasmesso|não emitido|μην σταλμένος||| +Cannot find empty conference|No puede encontrar conferencia vacía|Ne peut pas trouver la conférence vide|Kann nicht leere Konferenz finden|Non può trovare il congresso vuoto|Não pode encontrar a conferência vazia|Μην μποÏέστε να βÏείτε την κενή διάσκεψη||| +is not live|no está activo|n'est pas de phase|ist nicht Phasen|non è in tensione|não está vivo|δεν είναι ζωντανός||| +RECORDING WILL LAST UP TO 60 MINUTES|LA GRABACIÓN DURARà HASTA 60 MINUTOS|L'ENREGISTREMENT DURERA JUSQU'À 60 MINUTES|AUFNAHME DAUERT BIS 60 MINUTEN|LA REGISTRAZIONE DURERÀ FINO A 60 MINUTI|A GRAVAÇÃO DURARà ATÉ 60 MINUTOS|Η ΚΑΤΑΓΡΑΦΗ ΘΑ ΔΙΑΡΚΕΣΕΙ ΜΕΧΡΙ 60 ΛΕΠΤΑ||| +Parked Calls Display|Mostrar Llamadas Aparcadas|Affichage Garé D'Appels|Geparkte Anruf-Anzeige|Esposizione Parcheggiata Di Chiamate|Exposição Estacionada Das Chamadas|Σταθμευμένη επίδειξη κλήσεων||| +Database Query Script|Database Query Script|Manuscrit De Question De Base de données|Datenbank-Frage Index|Scritto Di Domanda Della Base di dati|Certificado Da Pergunta Da Base de dados|ΧειÏόγÏαφο εÏώτησης βάσεων δεδομένων||| +Group Choice|Opción Del Grupo|Choix De Groupe|Gruppe Wahl|Scelta Del Gruppo|Escolha Do Grupo|Επιλογή ομάδας||| +has been registered to user|se ha registrado al usuario|a été enregistré à l'utilisateur|ist zum Benutzer registriert worden|è stato registrato all'utente|foi registado ao usuário|έχει καταχωÏηθεί στο χÏήστη||| +HOPPER EMPTY|TOLVA VACÃA|DISTRIBUTEUR VIDE|ZUFUHRBEHÄLTER LEER|TRAMOGGIA VUOTA|FUNIL VAZIO|ΧΟΑÎΗ ΚΕÎΗ||| +LOG NOT ENTERED|REGISTRO NO ENTRADO|NOTATION NON ENTRÉE|MASCHINENBORDBUCH NICHT BETRETEN|CEPPO NON INSERITO|REGISTRO NÃO ENTRADO|ΠΟΥ ΔΕΠΕΙΣΑΓΕΤΑΙ ΚΟΥΤΣΟΥΡΟ||| +has been changed to|se ha cambiado a|a été changé en|ist zu geändert worden|è stato cambiato a|foi mudado a|έχει αλλαχτεί||| +information has been updated|La información ha sido actualizada|l'information a été mise à jour|Informationen sind aktualisiert worden|le informazioni sono state aggiornate|a informação foi atualizada|οι πληÏοφοÏίες έχουν ενημεÏωθεί||| +is now in status|ahora está en estado|est maintenant dans le statut|ist jetzt im Status|è ora nella condizione|está agora no status|είναι τώÏα στη θέση||| +Voicemail Check|Comprobar el buzón de voz|Contrôle De Voicemail|Voicemail Überprüfung|Controllo Di Voicemail|Verificação De Voicemail|Έλεγχος Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου||| +voicemail box|caja del buzón de voz|boîte de voicemail|voicemail Kasten|scatola del voicemail|caixa do voicemail|κιβώτιο Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου||| +Re-Login|Conexión Otra Vez|Re-Ouverture|Re-LOGON|Re-Inizio attività|Re-Início de uma sessão|Επαν-σÏνδεση||| +User Password|Contraseña Del Usuario|Mot de passe D'Utilisateur|Benutzer-Kennwort|Parola d'accesso Dell'Utente|Senha Do Usuário|Κωδικός Ï€Ïόσβασης χÏηστών||| +User Login|Conexión Del Usuario|Ouverture D'Utilisateur|Benutzer-LOGON|Inizio attività Dell'Utente|Início de uma sessão Do Usuário|ΣÏνδεση χÏηστών||| +Phone Login|Conexión Del Teléfono|Ouverture De Téléphone|Telefon-LOGON|Inizio attività Del Telefono|Início de uma sessão Do Telefone|Τηλεφωνική σÏνδεση||| +Phone Password|Contraseña Del Teléfono|Mot de passe De Téléphone|Telefon-Kennwort|Parola d'accesso Del Telefono|Senha Do Telefone|Τηλεφωνικός κωδικός Ï€Ïόσβασης||| +VALUE=SUBMIT|VALUE=SUBMIT|VALUE=SUBMIT|VALUE=SUBMIT|VALUE=SUBMIT|VALUE=SUBMIT|VALUE=SUBMIT||| +Campaign not active, please try again|La campaña no está activa, intentelo otra vez, por favor|La campagne non active, essayent svp encore|Die aktive Kampagne nicht, versuchen bitte noch einmal|La campagna non attiva, prova prego ancora|A campanha nao ativa, tenta por favor outra vez|Η εκστÏατεία μη ενεÏγός, παÏακαλώ Ï€Ïοσπαθεί πάλι||| +Login incorrect, please try again|La conexión incorrecta, intentelo otra vez, por favor|L'ouverture incorrecte, essayent svp encore|Der falsche LOGON, versuchen bitte noch einmal|L'inizio attività errato, prova prego ancora|O início de uma sessão incorreto, tenta por favor outra vez|Η σÏνδεση ανακÏιβής, παÏακαλώ Ï€Ïοσπαθεί πάλι||| +Campaign Login|Conexión en la Campaña|Ouverture De Campagne|Kampagne LOGON|Inizio attività Di Campagna|Início de uma sessão Da Campanha|ΣÏνδεση εκστÏατείας||| +Sorry, your phone login and password are not active in this system, please try again|Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor|Désolé, votre ouverture de téléphone et mot de passe ne soyez pas|Traurig, Ihr Telefon-LOGON und Kennwort seien Sie nicht in diesem|Spiacente, il vostri inizio attività del telefono e parola d'accesso|Pesaroso, seus início de uma sessão do telefone e senha não seja|ΘλιβεÏός, η τηλεφωνική σÏνδεση και ο κωδικός Ï€Ïόσβασής σας δεν είναι ενεÏγός σε αυτό το σÏστημα, παÏακαλώ Ï€Ïοσπαθήστε πάλι||| +leads left to call in hopper|Leads a la izquierda para llamar en Hopper|mène à gauche à appeler dans le distributeur|führt nach links, um im Zufuhrbehälter zu benennen|conduce a sinistra per denominare in tramoggia|conduz à esquerda para chamar-se no funil|μόλυβδοι που αφήνονται για να καλέσουν μέσα τη χοάνη||| +CAMPAIGN CUSTOM PARKING|PARKING PERSONALIZADO DE LA CAMPAÑA|STATIONNEMENT FAIT SUR COMMANDE DE CAMPAGNE|KAMPAGNE KUNDENSPEZIFISCHES PARKEN|PARCHEGGIO SU ORDINAZIONE DI CAMPAGNA|ESTACIONAMENTO FEITO SOB ENCOMENDA DA CAMPANHA|ΧΩΡΟΣ ΣΤΑΘΜΕΥΣΗΣ ΣΥÎΗΘΕΙΑΣ ΕΚΣΤΡΑΤΕΙΑΣ||| +CAMPAIGN DEFAULT PARKING|PARKING POR DEFECTO DE LA CAMPAñA|STATIONNEMENT DE DÉFAUT DE CAMPAGNE|KAMPAGNE RÜCKSTELLUNG PARKEN|PARCHEGGIO DI DIFETTO DI CAMPAGNA|ESTACIONAMENTO DO DEFEITO DA CAMPANHA|ΧΩΡΟΣ ΣΤΑΘΜΕΥΣΗΣ ΠΡΟΕΠΙΛΟΓΗΣ ΕΚΣΤΡΑΤΕΙΑΣ||| +CAMPAIGN CUSTOM WEB FORM|FORMULARIO WEB PERSONALIZADO DE LA CAMPAÑA|FORME FAITE SUR COMMANDE DE WEB DE CAMPAGNE|KAMPAGNE KUNDENSPEZIFISCHE NETZ-FORM|FORMA SU ORDINAZIONE DI FOTORICETTORE DI CAMPAGNA|FORMULÃRIO FEITO SOB ENCOMENDA DA CORREIA FOTORRECEPTORA DA CAMPANHA|ΜΟΡΦΗ ΙΣΤΟΥ ΣΥÎΗΘΕΙΑΣ ΕΚΣΤΡΑΤΕΙΑΣ||| +CAMPAIGN DEFAULT WEB FORM|FORMULARIO WEB POR DEFECTO DE LA CAMPAÑA|FORME DE WEB DE DÉFAUT DE CAMPAGNE|KAMPAGNE RÜCKSTELLUNG NETZ-FORM|FORMA DI FOTORICETTORE DI DIFETTO DI CAMPAGNA|FORMULÃRIO DA CORREIA FOTORRECEPTORA DO DEFEITO DA CAMPANHA|ΜΟΡΦΗ ΙΣΤΟΥ ΠΡΟΕΠΙΛΟΓΗΣ ΕΚΣΤΡΑΤΕΙΑΣ||| +CAMPAIGN ALLOWS CLOSERS|LA CAMPAÑA PERMITE CLOSERS|LA CAMPAGNE PERMET CLOSERS|KAMPAGNE ERLAUBT CLOSERS|LA CAMPAGNA PERMETTE CLOSERS|A CAMPANHA PERMITE CLOSERS|Η ΕΚΣΤΡΑΤΕΙΑ ΕΠΙΤΡΕΠΕΙ ΠΙΟ ΚΟÎΤΑ||| +CAMPAIGN ALLOWS NO CLOSERS|LA CAMPAÑA NO PERMITE CLOSERS|LA CAMPAGNE NE PERMET AUCUN CLOSERS|KAMPAGNE ERLAUBT KEIN CLOSERS|LA CAMPAGNA NON PERMETTE CLOSERS|A CAMPANHA NÃO PERMITE NENHUM CLOSERS|Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΕΠΙΤΡΕΠΕΙ ΚΑÎΕÎΑ ΠΙΟ ΚΟÎΤΑ||| +USING PREVIOUS MEETME ROOM|USAR EL SITIO ANTERIOR DE MEETME|EMPLOYER LA PIÈCE PRÉCÉDENTE DE MEETME|VERWENDEN DES VORHERGEHENDEN MEETME RAUMES|USANDO LA STANZA PRECEDENTE DI MEETME|USANDO O QUARTO PRECEDENTE DE MEETME|ΧΡΗΣΙΜΟΠΟΙΗΣΗ ΤΟΥ ΠΡΟΗΓΟΥΜΕÎΟΥ ΔΩΜΑΤΊΟΥ MEETME||| +USING NEW MEETME ROOM|USAR EL NUEVO SITIO DE MEETME|EMPLOYER LA NOUVELLE PIÈCE DE MEETME|VERWENDEN DES NEUEN MEETME RAUMES|USANDO LA NUOVA STANZA DI MEETME|USANDO O QUARTO NOVO DE MEETME|ΧΡΗΣΙΜΟΠΟΙΗΣΗ ΤΟΥ ÎΕΟΥ ΔΩΜΑΤΊΟΥ MEETME||| +old QUEUE and INCALL reverted list|vieja COLA y lista invertida INCALL|vieille FILE D'ATTENTE et liste retournée par INCALL|alte WARTESCHLANGE und INCALL umgeschaltete Liste|vecchia CODA e lista ritornata INCALL|FILA velha e lista reverted INCALL|παλαιά ΣΕΙΡΑ ΑÎΑΜΟÎΉΣ και επανεÏχόμενος INCALL κατάλογος||| +old QUEUE and INCALL reverted hopper|vieja COLA y tolva invertida INCALL|vieille FILE D'ATTENTE et distributeur retourné par INCALL|alte WARTESCHLANGE und INCALL umgeschalteter Zufuhrbehälter|vecchia CODA e tramoggia ritornata INCALL|FILA velha e funil reverted INCALL|παλαιά ΣΕΙΡΑ ΑÎΑΜΟÎΉΣ και επανεÏχόμενη INCALL χοάνη||| +old vicidial_live_agents records cleared|viejos expedientes de los vicidial_live_agents despejados|vieux disques de vicidial_live_agents dégagés|alte vicidial_live_agents Aufzeichnungen löschten|vecchie annotazioni dei vicidial_live_agents eliminate|os registros velhos dos vicidial_live_agents cancelaram|παλαιά αÏχεία vicidial_live_agents που καθαÏίζονται||| +campaign is set to auto_dial_level|la campaña se fija al auto_dial_level|la campagne est placée à l'auto_dial_level|Kampagne wird auf auto_dial_level eingestellt|la campagna è regolata a auto_dial_level|a campanha é ajustada ao auto_dial_level|η εκστÏατεία τίθεται auto_dial_level||| +new vicidial_live_agents record inserted|Insertadas las grabaciones nueva de los vicidial_live_agents|nouveau disque de vicidial_live_agents inséré|neue vicidial_live_agents Aufzeichnung eingesetzt|la nuova annotazione dei vicidial_live_agents ha inserito|o registro novo dos vicidial_live_agents introduziu|νέο αÏχείο vicidial_live_agents που παÏεμβάλλεται||| +campaign is set to manual dial|la campaña está configurada con marcaje manual|la campagne est placée au cadran manuel|Kampagne wird auf manuellen Vorwahlknopf eingestellt|la campagna è regolata alla manopola manuale|a campanha é ajustada ao seletor manual|η εκστÏατεία τίθεται το χειÏωνακτικό πίνακα||| +Sorry, there are no leads in the hopper for this campaign|Lo siento, no hay leads en el hopper de esta campaña|Désolé, il n'y a aucun fil dans le distributeur pour cette campagne|Traurig, gibt es keine Leitungen im Zufuhrbehälter für diese|Spiacenti, non ci sono cavi nella tramoggia per questa campagna|Pesaroso, não há nenhuma ligação no funil para esta campanha|ΘλιβεÏός, δεν υπάÏχει κανένας μόλυβδος στη χοάνη για αυτήν την εκστÏατεία||| +Dial Next Number|Marcar el Siguiente Número|Prochain Nombre De Cadran|Vorwahlknopf-Folgende Zahl|Numero Seguente Della Manopola|Número Seguinte Do Seletor|Επόμενος αÏιθμός πινάκων||| +LIVE CALLS IN YOUR SESSION|LLAMADAS ACTIVAS EN SU SESIÓN|VIVENT LES APPELS EN VOTRE SESSION|LEBEN ANRUFE IN IHREM LERNABSCHNITT|VIVONO LE CHIAMATE NELLA VOSTRA SESSIONE|VIVEM AS CHAMADAS EM SUA SESSÃO|ΖΗΣΤΕ ΚΛΗΣΕΙΣ ΣΤΗ ΣΥÎΟΔΟ ΣΑΣ||| +Stop Recording|Parar La Grabación|Cessez L'Enregistrement|Stoppen Sie Zu notieren|Smetta Di registrare|Pare de Gravar|ΚαταγÏαφή στάσεων||| +Start Recording|Comenzar La Grabación|Commencez À enregistrer|Fangen Sie an Zu notieren|Inizi A registrare|Comece Gravar|ΚαταγÏαφή έναÏξης||| +Transfer number must have more than 1 digit|El número de la transferencia debe tener más de 1 dígito|Le nombre de transfert doit avoir plus de 1 chiffre|Übergangszahl muß mehr als 1 Stelle haben|Il numero di trasferimento deve avere più di 1 cifra|O número de transferência deve ter mais de 1 dígito|Ο αÏιθμός μεταφοÏάς Ï€Ïέπει να έχει πεÏισσότεÏο από 1 ψηφίο||| +Grab Parked Call|Capturar llamada en Parking|Appel Garé Par Encavateur|Zupacken Geparkter Anruf|Chiamata Parcheggiata Gru a benna|Chamada Estacionada Garra|Η αÏπαγή στάθμευσε την κλήση||| +Park Call|Aparcar llamada|Appel De Parc|Park-Anruf|Chiamata Del Parco|Chamada Do Parque|Κλήση πάÏκων||| +Waiting for Ring|Espeerar al Ring|Anneau d'attente|Wartering|Anello attendente|Anel de espera|Αναμονή το δαχτυλίδι||| +Called 3rd party|Terceros llamados|Tiers appelé|Angerufene 3. Partei|Terzi denominati|Ó partido chamado|ΑποκαλοÏμενο 3$ο συμβαλλόμενο μέÏος||| +LEAVE 3-WAY CALL|ABANDONAR LLAMADA 3-WAY|APPEL DU CONGÉ 3-WAY|ANRUF DES URLAUB-3-WAY|CHIAMATA DI PERMESSO 3-WAY|CHAMADA DA LICENÇA 3-WAY|3-ΤΡΟΠΟΣ ΚΛΗΣΗ ΑΔΕΙΑΣ||| +Dial With Customer|Marcar Con El Cliente|Cadran Avec Le Client|Vorwahlknopf Mit Kunden|Manopola Con Il Cliente|Seletor Com Cliente|Πίνακας με τον πελάτη||| +Park Customer Dial|Dial Del Cliente Del Parque|Cadran De Client De Parc|Park-Kunde Vorwahlknopf|Manopola Del Cliente Del Parco|Seletor Do Cliente Do Parque|Πίνακας πελατών πάÏκων||| +Hangup Xfer Line|Colgar Línea Xfer |Ligne De Xfer De Décrochement|Hängezustand Xfer Linie|Linea Di Xfer Di Hangup|Linha De Xfer Do Hangup|ΓÏαμμή Xfer Hangup||| +Hangup Both Lines|Colgar Ambas Líneas|Décrochement Les deux Lignes|Hängezustand Beide Linien|Hangup Entrambe le Linee|Hangup Ambas as Linhas|Hangup και οι δÏο γÏαμμές||| +Hangup Customer|Colgar al Cliente|Client De Décrochement|Hängezustand-Kunde|Cliente Di Hangup|Cliente Do Hangup|Πελάτης Hangup||| +Transfer - Conference|Transferencia - Conferencia|Transfert - Conférence|Übertragung - Konferenz|Trasferimento - Congresso|Transferência - Conferência|ΜεταφοÏά - διάσκεψη||| +LOCAL CLOSER|CLOSER LOCAL|GENS DU PAYS PLUS ÉTROITS|EINHEIMISCHER GENAUER|LOCAL PIÙ VICINO|LOCAL MAIS PRÓXIMO|ΤΟΠΙΚΟΣ ΠΙΟ ΣΤΕÎΌΣ||| +INTERNAL CLOSER|CLOSER INTERNO|PLUS ÉTROIT INTERNE|INTERNES GENAUERES|PIÙ VICINO INTERNO|MAIS PRÓXIMO INTERNO|ΕΣΩΤΕΡΙΚΟΣ ΠΙΟ ΣΤΕÎΌΣ||| +Dial Blind Transfer|Marcar Blind Transfer|Transfert D'Aveugle De Cadran|Vorwahlknopf-Vorhang-Übertragung|Trasferimento Dei Ciechi Della Manopola|Transferência Da Cortina Do Seletor|Τυφλή μεταφοÏά πινάκων||| +Dial timed out, contact your system administrator|Tiempo de espera superado, pongase en contacto con su administrador de sistema|Le cadran chronométré dehors, contactent votre interface|Zeit Vorwahlknopf, der heraus festgesetzt wird, treten mit Ihrem|La manopola cronometrata fuori, si mette in contatto con il vostro|O seletor cronometrado para fora, contata seu administrador de|Ο πίνακας χÏονομετÏημένος έξω, έÏχεται σε επαφή με το διοικητή συστημάτων σας||| +No more leads in the hopper for campaign|No más Leads en el hopper de la campaña|Pas plus ne mène dans le distributeur pour la campagne|Kein mehr führt im Zufuhrbehälter für Kampagne|Nient'altro conduce nella tramoggia per la campagna|Não mais conduz no funil para a campanha|Όχι άλλοι μόλυβδοι στη χοάνη για την εκστÏατεία||| +Web Form|Formulario Web|Forme de Web|Netz-Form|Forma Di Fotoricettore|Formulário Da Correia fotorreceptora|ΜοÏφή ΙστοÏ||| +You Must Select a Disposition|Usted debe seleccionar una disposición|Vous devez choisir une disposition|Sie müssen eine Einteilung vorwählen|Dovete selezionare una disposizione|Você deve selecionar uma disposição|ΠÏέπει να επιλέξετε μια διάθεση||| +GROUPS NOT SELECTED|GRUPOS NO SELECCIONADOS|GROUPES NON CHOISIS|GRUPPEN NICHT VORGEWÄHLT|GRUPPI NON SELEZIONATI|GRUPOS NÃO SELECIONADOS|ΠΟΥ ΔΕΠΕΠΙΛΕΓΟÎΤΑΙ ΟΜΑΔΕΣ||| +SELECTED GROUPS|GRUPOS SELECCIONADOS|GROUPES CHOISIS|VORGEWÄHLTE GRUPPEN|GRUPPI SELEZIONATI|GRUPOS SELECIONADOS|ΕΠΙΛΕΓΜΕÎΕΣ ΟΜΑΔΕΣ||| +You cannot log out during a Dial attempt|Usted no puede salir durante un intento de marcado|Vous ne pouvez pas vous déconnecter pendant une tentative de|Sie können nicht heraus während eines Vorwahlknopfversuchs loggen|Non potete annotare fuori durante il tentativo della manopola|Você não pode registrar para fora durante uma tentativa do seletor|Δεν μποÏείτε αποσÏνδεση κατά τη διάÏκεια μιας Ï€Ïοσπάθειας πινάκων||| +Wait 50 seconds for the dial to fail out if it is not answered|Esperar 50 segundos para que el marcado falle si no es respondido|Attendez 50 secondes le cadran pour échouer dehors si on ne lui|Warten Sie, daß 50 Sekunden auf den Vorwahlknopf heraus ausfallen,|Aspetti 50 secondi la manopola per venire a mancare fuori se non è|Espere 50 segundos pelo seletor para falhar para fora se não se|ΠεÏιμένετε 50 δευτεÏόλεπτα τον πίνακα για να αποτÏχετε έξω εάν δεν απαντιέται||| +STILL A LIVE CALL! Hang it up then you can log out|TODAVÃA UNA LLAMADA ACTIVA! Colgar y luego salir|Un APPEL TOUJOURS DE PHASE ! Accrochez-le vers le haut alors que vous|NOCH Ein PHASENANRUF! Hängen Sie ihn, oben dann, das Sie heraus|ANCORA Una CHIAMATA IN TENSIONE! Appendala in su allora che potete|AINDA Uma CHAMADA VIVA! Pendure-a acima então que você pode|ΑΚΟΜΑ μια ΖΩÎΤΑÎΗ ΚΛΗΣΗ! Το κÏεμάστε επάνω έπειτα εσείς μποÏεί αποσÏνδεση||| +Hide conference call channel information|Ocultar la información del canal Conferencia|L'information de canal de conférence téléphonique de peau|Fellkonferenzanruf-Führung Informationen|Le informazioni della scanalatura di chiamata di congresso del|Informação da canaleta da chamada de conferência do hide|ΠληÏοφοÏίες καναλιών κλήσης διασκέψεων δοÏών||| +Show conference call channel information|Mostrar la información del canal Conferencia|Montrez l'information de canal de conférence téléphonique|Zeigen Sie Konferenzanruf-Führung Informationen|Mostri le informazioni della scanalatura di chiamata di congresso|Mostre a informação da canaleta da chamada de conferência|ΠαÏουσιάστε πληÏοφοÏίες καναλιών κλήσης διασκέψεων||| +Logged in as User|Usuario|Utilisateur|Benutzer|Utente|Usuário|ΧÏήστης ||| +Noone is in your session|Nadie está en su sesión|Aucun n'est en votre session|Noone ist in Ihrem Lernabschnitt|Nessuno è nella vostra sessione|Noone está em sua sessão|Κανένας δεν είναι στη σÏνοδό σας||| +Customer has hung up|El cliente ha colgado|Le client a raccroché|Kunde hat oben gehangen|Il cliente ha appeso in su|O cliente pendurou acima|Ο πελάτης έχει κλείσει το τηλέφωνο||| +End-of-call Disposition Selection|selección de la disposición del End-of-call|Extrémité-de-appelez Le Choix De Disposition|Ende-von-benennen Sie Einteilung Vorwähler|Estremità-de-denomini La Selezione Di Disposizione|Extremidade-$$$-CHAME A Seleção Da Disposição|Επιλογή διάθεσης τέλος-$$$-ΚΛΉΣΗΣ||| +CLOSER INBOUND GROUP SELECTION|SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER|UN CHOIX DE GROUPE D'ARRIVÉE PLUS ÉTROIT|GENAUERE INBOUND GRUPPENWAHL|SELEZIONE DI GRUPPO INBOUND PIÙ VICINA|SELEÇÃO DE GRUPO INBOUND MAIS PRÓXIMA|ΠΙΟ ΣΤΕÎΉ ΕΙΣΕΡΧΟΜΕÎΗ ΕΠΙΛΟΓΗ ΟΜΑΔΑΣ||| +Closer Inbound Group Selection|SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER|Un Choix De Groupe D'arrivée Plus étroit|Genauere Inbound Gruppenwahl|Selezione Di Gruppo Inbound Più vicina|Seleção De Grupo Inbound Mais próxima|Πιό στενή εισεÏχόμενη επιλογή ομάδας||| +BLENDED CALLING|BLENDED CALLING|APPELER MÉLANGÉ|GEMISCHTES BENENNEN|CHIAMATA MESCOLATA|CHAMADA MISTURADA|ΣΥÎΔΥΑΣΜΕÎΗ ΚΛΗΣΗ||| +outbound activated|Salientes activdas|en partance activé|outbound aktiviert|outbound attivato|outbound ativado|εξεÏχόμενος που ενεÏγοποιείται||| +Preview the Lead then|Mostrar el Lead entonces|Visionnez le fil alors|Sehen Sie die Leitung dann vorher|Allora veda in anteprima il cavo|Inspecione a ligação então|ΠÏόβλεψη ο μόλυβδος έπειτα||| +Lead was not reverted, there was an error|El Lead no fue invertido, hubo un error|Le fil n'a pas été retourné, il n'y avait pas une erreur|Leitung wurde nicht umgeschaltet, es gab eine Störung|Il cavo non è stato ritornato, ci non era un errore|A ligação não reverted, não havia um erro|Ο μόλυβδος δεν επανήλθε, υπήÏξε ένα λάθος||| +call was not placed, there was an error|la llamada no fue atendida, hubo un error|l'appel n'a pas été placé, il n'y avait pas une erreur|Anruf wurde nicht gesetzt, es gab eine Störung|la chiamata non è stata disposta, ci non era un errore|a chamada não foi colocada, não havia um erro|η κλήση δεν τοποθετήθηκε, υπήÏξε ένα λάθος||| +Number to call|Número a llamar|Nombre à appeler|Zahl zum zu benennen|Numero da denominare|Número a chamar-se|ΑÏιθμός που καλεί||| +Customer Information|Información Del Cliente|L'Information De Client|Kunde Informationen|Le Informazioni Del Cliente|Informação Do Cliente|ΠληÏοφοÏίες πελατών||| +Lead Dispositioned As|Lead Dispositioned Como|Fil Dispositioned As|Leitung Dispositioned Wie|Cavo Dispositioned As|Ligação Dispositioned Como|Μόλυβδος Dispositioned όπως||| +When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Cuando esté activo, presione simplemente la tecla para la disposición deseada para esta llamada. La llamada después será colgada y dispositioned automáticamente|Si actif, appuyez sur simplement la touche de clavier pour la|Wenn aktiv, betätigen Sie einfach die Taste für die gewünschte|Una volta attivo, premi semplicemente la chiave di tastiera per la|Quando ativo, pressione simplesmente a chave de teclado para a|Όταν ενεÏγός, πιέστε απλά το πλήκτÏο πληκτÏολογίων για την επιθυμητή διάθεση για αυτήν την κλήση. Η κλήση θα είναι έπειτα hungup και αυτόματα||| +Disposition Hot Keys|Teclas de acceso rápido a la Disposición|Touches Directes De Disposition|Einteilung Heiße Schlüssel|Chiavi Calde Di Disposizione|Chaves Quentes Da Disposição|Καυτά κλειδιά διάθεσης||| +Cust Time|Tiempo|Temps De Cust|Cust Zeit|Tempo Di Cust|Tempo De Cust|ΧÏόνος Cust||| +RECORD ID|GRABACIÓN ID|IDENTIFICATION RECORD|SATZ IDENTIFIKATION|IDENTIFICAZIONE RECORD|ID RECORD|ΑΡΧΕΙΟ ΤΑΥΤΌΤΗΤΑ||| +RECORDING FILE|GRABANDO ARCHIVO|DOSSIER D'ENREGISTREMENT|REGISTERAKTE|LIMA DI REGISTRAZIONE|LIMA DE GRAVAÇÃO|ΑΡΧΕΙΟ ΚΑΤΑΓΡΑΦΗΣ||| +HOT KEYS ACTIVE|TECLAS ACCESO RÃPIDO ACTIVAS|TOUCHES DIRECTES ACTIVES|HEISSE SCHLÜSSEL AKTIV|CHIAVI CALDE ATTIVE|CHAVES QUENTES ATIVAS|ΚΑΥΤΑ ΚΛΕΙΔΙΑ ΕÎΕΡΓΑ||| +HOT KEYS INACTIVE|TECLAS ACCESO RÃPIDO INACTIVAS|TOUCHES DIRECTES INACTIVES|HEISSE SCHLÜSSEL UNAKTIVIERT|CHIAVI CALDE INATTIVE|CHAVES QUENTES INATIVAS|ΚΑΥΤΑ ΚΛΕΙΔΙΑ ΑÎΕÎΕΡΓΑ||| +DIAL OVERRIDE|INVALIDACIÓN DEL MARCADO|DÉPASSEMENT DE CADRAN|VORWAHLKNOPF-ÜBERSTEUERUNG|SOVRAPPOSIZIONE DI UN COMANDO MANUALE DELLA MANOPOLA|ULTRAPASSAGEM DO SELETOR|ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΠΙÎΑΚΩÎ||| +SKIP LEAD|SALTAR LEAD|FIL DE SAUT|ZEILENSPRUNG-LEITUNG|CAVO DI SALTO|LIGAÇÃO DA FAIXA CLARA|ΜΟΛΥΒΔΟΣ ΕΚΣΚΑΦΕΩÎ||| +DIAL LEAD|MARCAR LEAD|FIL DE CADRAN|VORWAHLKNOPF-LEITUNG|CAVO DELLA MANOPOLA|LIGAÇÃO DO SELETOR|ΜΟΛΥΒΔΟΣ ΠΙÎΑΚΩÎ||| +LEAD PREVIEW|MOSTRAR LEAD|PRÉVISION DE FIL|LEITUNG VORBETRACHTUNG|PREVISIONE DEL CAVO|INSPECÇÃO PRÉVIA DA LIGAÇÃO|ΠΡΟΒΛΕΨΗ ΜΟΛΥΒΔΟΥ||| +STOP CALLING|PARAR LA LLAMADA|CESSEZ D'APPELER|STOPPEN SIE ZU BENENNEN|SMETTA DI DENOMINARE|PARE DE CHAMAR-SE|ΚΛΗΣΗ ΣΤΑΣΕΩÎ||| +DISPOSITION CALL|DISPOSITION CALL|APPEL DE DISPOSITION|EINTEILUNG ANRUF|CHIAMATA DI DISPOSIZIONE|CHAMADA DA DISPOSIÇÃO|ΚΛΗΣΗ ΔΙΑΘΕΣΗΣ||| + session ID| sesión ID| ID de session| Lernabschnitt ID| ID di sessione| sessão ID| Ταυτότητα συνόδου||| + to campaign| a la campaña| à la campagne| zur Kampagne| alla campagna| à campanha| Στην εκστÏατεία||| +Title|Título|Titre|Titel|Titolo|Título|Τίτλος||| +STATUS|ESTADO|STATUT|STATUS|CONDIZIONE|STATUS|ΘΕΣΗ||| +RESET|REINICIAR|REMISE|ZURÜCKSTELLEN|RISISTEMAZIONE|RESTAURAÇÃO|ΑÎΑΣΤΟΙΧΕΙΟΘΕΤΗΣΗ||| +TYPE=SUBMIT|TYPE=submit|TYPE=submit|TYPE=submit|TYPE=submit|TYPE=submit|TYPE=submit||| +SUBMIT|ENVIAR|SOUMETTEZ|SUBMITSie|PRESENTI|SUBMETA|ΥΠΟΒΑΛΤΕ||| +Incoming|Entrante|Entrant|Ankommend|Ricevuto|Entrante|ΕισεÏχόμενος||| +Calling|Llamando|Appeler|Benennen|Chiamata|Chamada|Κλήση||| +Called|Llamado|Appelé|Benannt|Denominato|Chamado|ΑποκαλοÏμενος||| +Campaign|Campaña|Campagne|Kampagne|Campagna|Campanha|ΕκστÏατεία||| +Status|Estado|Statut|Status|Condizione|Status|Θέση||| +Inserted|Insertado|Inséré|Eingesetzt|Inserito|Introduzido|Ένθετο ||| +seconds|segundos|secondes|Sekunden|secondi|segundos|δευτεÏόλεπτα||| +HELP|AYUDA|AIDE|HILFE|AIUTO|AJUDA|ΒΟΗΘΕΙΑ||| +Login|Conexión|Ouverture|LOGON|Inizio attività|Início de uma sessão|ΣÏνδεση||| +User|Usuario|Utilisateur|Benutzer|Utente|Usuário|ΧÏήστης||| +Password|Contraseña|Mot de passe|Kennwort|Parola d'accesso|Senha|Κωδικός Ï€Ïόσβασης||| +VERSION|VERSIÓN|VERSION|VERSION|VERSIONE|VERSÃO|ΕΚΔΟΣΗ||| +BUILD|CONSTRUCCION|CONSTRUCTION|BAU|CONFIGURAZIONE|CONFIGURAÇÃO|ΧΤΙΣΤΕ||| +Server|Servidor|Serveur|Bediener|Assistente|Usuário|ΚεντÏικός υπολογιστής||| +RECORD|GRABACIÓN|DISQUE|SATZ|ANNOTAZIONE|REGISTRO|ΑΡΧΕΙΟ||| +HANGUP|COLGAR|DÉCROCHEMENT|HÄNGEZUSTAND|HANGUP|HANGUP|HANGUP||| +XFER|TRANSFERENCIA|XFER|XFER|XFER|XFER|XFER||| +PARK|PARKING|PARC|PARK|PARCO|PARQUE|ΠΑΡΚΟ||| +IN-NUMBER|NÚMERO-ENTRANTE|IN-NUMBER|IN-NUMBER|IN-NUMBER|IN-NUMBER|$$$-ΑΡΙΘΜΟΣ||| +NUMBER|NÚMERO|NOMBRE|ZAHL|NUMERO|NÚMERO|ΑΡΙΘΜΟΣ||| +MAXLENGTH|maxlength|MAXLENGTH|MAXLENGTH|MAXLENGTH|MAXLENGTH|MAXLENGTH||| +LENGTH|LONGITUD|LONGUEUR|LÄNGE|LUNGHEZZA|COMPRIMENTO|ΜΗΚΟΣ||| +CALLERID|LLAMADORID|CALLERID|CALLERID|CALLERID|CALLERID|CALLERID||| +CallerID|LlamadorID|CallerID|CallerID|CallerID|CallerID|CallerID||| +CALL|LLAMADA|APPEL|ANRUF|CHIAMATA|CHAMADA|ΚΛΗΣΗ||| +PICKUP|CAPTURAR|COLLECTE|AUFNAHME|RACCOLTA|COLETOR|ΕΠΑÎΑΛΕΙΨΗ||| +CONFERENCE|CONFERENCIA|CONFÉRENCE|KONFERENZ|CONGRESSO|CONFERÊNCIA|ΔΙΑΣΚΕΨΗ||| +Refresh|Recarga|Régénérez|ErneuernSie|Rinfreschi|Refresque|Αναζωογονήστε||| +Send DTMF|Enviar DTMF|Envoyez DTMF|Senden Sie DTMF|Trasmetta DTMF|Emita DTMF|Στείλετε DTMF||| +BORDER|Border|Border|Border|Border|Border|Border||| +ORDER|ORDEN|ORDRE|AUFTRAG|ORDINE|ORDEM|ΔΙΑΤΑΓΗ||| + on | en | sur | auf | su | em | Στην ||| +LOGOUT|SALIR|DÉCONNEXION|LOGOUT|TERMINE|LOGOUT|ΑΠΟΣΥÎΔΕΣΗ||| +Channel|Canal|LaManche|Führung|Manica|Canaleta|Κανάλι||| +Extensions|Extensiones|Prolongements|Verlängerungen|Estensioni|Extensões|Επεκτάσεις||| +Conferences|Conferencias|Conférences|Konferenzen|Congressi|Conferências|Διασκέψεις||| +Conference|Conferencia|Conférence|Konferenz|Congresso|Conferência|Διάσκεψη||| +Recording|GRABANDO|Enregistrement|Aufnahme|Registrazione|Gravação|ΚαταγÏαφή||| +Record|Grabar|Disque|Aufzeichnung|Annotazione|Registro|ΑÏχείο||| +Welcome|Bienvenido|Bienvenue|Willkommen|Benvenuto|Boa vinda|Υποδοχή||| +VOICEMAIL|BUZÓN DE VOZ|VOICEMAIL|VOICEMAIL|VOICEMAIL|VOICEMAIL|ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΊΟ||| +NEW|NUEVO|NOUVEAU|NEU|NUOVO|NOVO|ÎΕΟΣ||| +OLD|VIEJO|VIEUX|ALT|VECCHIO|VELHO|ΠΑΛΑΙΟΣ||| +PAUSE|PAUSA|PAUSE|PAUSE|PAUSA|PAUSA|ΜΙΚΡΗ ΔΙΑΚΟΠΉ||| +START|COMIENZO|DÉBUT|ANFANG|INIZIO|COMEÇO|ΕÎΑΡΞΗ||| +Pause|Pausa|Pause|Pause|Pausa|Pausa|Στάση||| +Resume|Comienzo|Résumé|Zusammenfassung|Resume|Resumo|Επαναλάβετε||| +Faster|Más rápido|Plus rapidement|Schneller|Più velocemente|Mais rapidamente|ΓÏηγοÏότεÏα||| +Slower|Más lento|Plus lent|Langsamer|Più lento|Mais lento|Πιό αÏγός||| +Initializing|Inizializando|Initialisation|Initialisierung|Inizializzazione|Inicializar|ΜονογÏαφή||| +Invalid|Inválido|Inadmissible|Unzulässig|Non valido|Inválido|ΑκυÏος||| +Username|Nombre del usuario|Username|Username|Username|Username|Όνομα χÏήστη||| +CUSTOM|A MEDIDA|COUTUME|GEWOHNHEIT|ABITUDINE|COSTUME|ΣΥÎΗΘΕΙΑ||| +Notes|Notas|Notes|Anmerkungen|Note|Notas|Σημειώσεις||| +First|Primero|D'abord|Zuerst|In primo luogo|Primeiramente|ΠÏώτα||| +MI: |IM: |MI :|MI:|Mi:|Mi:|MI:||| +Last|Último|Bout|Letztes|Ultimo|Último|ΔιαÏκέστε||| +Address|Dirección|Adresse|Adresse|Indirizzo|Endereço|ΔιεÏθυνση||| +City|Ciudad|Ville|Stadt|Città|Cidade|Πόλη||| +State|Estado|État|Zustand|Dichiari|Estado|ΚÏάτος||| +PostCode|Código Postal|Code postal|PostCode|PostCode|PostCode|PostCode||| +Province|Provincia|Province|Provinz|Provincia|Província|ΕπαÏχία||| +Vendor ID|Vendedor ID|Identification De Fournisseur|Verkäufer Identifikation|Identificazione Del Fornitore|Vendedor Id|Ταυτότητα Ï€Ïομηθευτών||| +DialCode|Código Del Dial|DialCode|DialCode|DialCode|DialCode|DialCode||| +Alt. Phone|Teléfono Alt|Alt. Téléphone|Wech Telefon|Alt. Telefono|Alt. Telefone|ΕÎΑ. Τηλέφωνο||| +Show|Demostración|Exposition|Erscheinen|Esposizione|Mostra|ΠαÏουσιάστε||| +Email|Email|Email|Email|Email|Email|ΗλεκτÏονικό ταχυδÏομείο||| +Comments|Comentarios|Commentaires|Anmerkungen|Osservazioni|Comentários|Σχόλια||| +REFRESH|ACTUALIZAR|RÉGÉNÉREZ|ERNEUERNSie|RINFRESCHI|REFRESQUE|ΑÎΑΖΩΟΓΟÎΗΣΤΕ||| +ALT PHONE DIAL|TELÉFONO DEL ALT|TÉLÉPHONE D'ALT|WECH TELEFON|ALT DEL TELEFONO|ALT DO TELEFONE|ENA ΤΗΛΕΦΩÎΙΚΟΣ||| +MAIN PHONE|TELÉFONO PRINCIPAL|TÉLÉPHONE PRINCIPAL|MAIN TELEFON|TELEFONO PRINCIPALE|TELEFONE PRINCIPAL|ΚΥΡΙΟ ΤΗΛΕΦΩÎΟ||| +ALT PHONE|TELÉFONO ALT|TELÉFONO DEL ALT|TÉLÉPHONE D'ALT|WECH TELEFON|ALT DEL TELEFONO|ALT DO TELEFONE||| +ADDRESS3|DIRECCIÓN3|ADRESSE3|ADRESSE3|INDIRIZZO3|ENDEREÇO3|ΔΙΕΥΘΥÎΣΗ3||| +FINISH LEAD|ACABAR LEAD|FINITION|ENDE|RIVESTIMENTO|REVESTIMENTO|ΤΕΛΕΙΩΣΤΕ||| +Dial Alt Phone Number|Marcar Número de teléfono Alt|Nombre Alt De Cadran|Vorwahlknopf-Wech Zahl|Numero Alt Della Manopola|Número Alt Do Seletor|Ενα αÏιθμός πινάκων||| +Phone|Teléfono|Téléphone|Telefon|Telefono|Telefone|Τηλέφωνο||| +DIAL|DIAL|CADRAN|VORWAHLKNOPF|MANOPOLA|SELETOR|ΠΙÎΑΚΑΣ||| +"JAN"|"ENE"|"JAN"|"JAN"|"GEN"|"JAN"|"ΙΑÎ"|""|""|" +"FEB"|"FEB"|"FÉV"|"FEB"|"FEB"|"FEV"|"ΦΕΒ"|""|""|" +"MAR"|"MAR"|"MAR"|"MÄR"|"MAR"|"MAR"|"ΜΑΡ"|""|""|" +"APR"|"ABR"|"AVR"|"APR"|"APR"|"ABR"|"ΑΠΡ"|""|""|" +"MAY"|"PUE"|"PEU"|"MÖG"|"POS"|"POS"|"ΜΆΙ"|""|""|" +"JUN"|"JUN"|"JUN"|"JUN"|"GIU"|"JUN"|"ΙΟÎ"|""|""|" +"JLY"|"JUL"|"JUL"|"JLY"|"LUG"|"JLY"|"ΙΟΛ"|""|""|" +"AUG"|"AGO"|"AOÛ"|"AUG"|"AGO"|"AGO"|"ΑΥΓ"|""|""|" +"SEP"|"SEP"|"SEP"|"SEP"|"SET"|"SET"|"ΣΕΠ"|""|""|" +"OCT"|"OCT"|"OCT"|"OKT"|"OTT"|"OUT"|"ΟΚΤ"|""|""|" +"NOV"|"NOV"|"NOV"|"NOV"|"NOV"|"NOV"|"ÎΟΕ"|""|""|" +"DEC"|"DIC"|"DÉC"|"DEZ"|"DIC"|"DEZ"|"ΔΕΚ"|""|""|" +\./images/|../agc/images/|../agc/images/|../agc/images/|../agc/images/|../agc/images/|../agc/images/||| diff --git a/LANG_admin/LANG_admin/languages_admin.txt b/LANG_admin/LANG_admin/languages_admin.txt new file mode 100644 index 0000000..4205937 --- /dev/null +++ b/LANG_admin/LANG_admin/languages_admin.txt @@ -0,0 +1,709 @@ +# languages_admin.txt - this file is for the internationalization of the astGUIclient || +# admin web pages. The associated config.pl file will take the language as an || +# argument and alter the php scripts to the language typed in the command line:|| +# example: ./config.pl --language=es|| +# current languages in the file:|| +# - English - (en) no alterations|| +# - Spanish - (es) first column|| +# - French - (fr) second column|| +# - German - (de) third column|| +# - Italian - (it) fourth column|| +***LANGUAGES***|| +en-English|es-Español| +***FILES***|| +astguiclient|admin.php|0 +astguiclient|remote_inbound.php|0 +astguiclient|phone_stats.php|0 +astguiclient|inbound_popup.php|0 +astguiclient|AST_inboundEXTstats.php|0 +astguiclient|dbconnect.php|1 +astguiclient|htglobalize.php|1 +vicidial|admin.php|0 +vicidial|dbconnect.php|1 +vicidial|htglobalize.php|1 +vicidial|AST_VICIDIAL_hopperlist.php|0 +vicidial|server_stats.php|0 +vicidial|AST_VDADstats.php|0 +vicidial|AST_timeonVDAD.php|0 +vicidial|AST_timeonVDAD_closer.php|0 +vicidial|listloader.php|0 +vicidial|listloaderMAIN.php|0 +vicidial|count.htm|1 +vicidial|help.gif|1 +astguiclient|help.gif|1 +vicidial|user_stats.php|0 +vicidial|remote_dispo.php|0 +vicidial|group_hourly_stats.php|0 +vicidial|admin_search_lead.php|0 +vicidial|admin_modify_lead.php|0 +vicidial|AST_CLOSERstats.php|0 +vicidial|vdremote.php|0 +***TRANSLATIONS***|| +English|Inglés| +Spanish|Español| +French|Francés| +German|Alemán| +Italian|Italiano| +\.\/images\/|../agc/images/| +You have now logged out. Thank you|Usted ahora ha salido. Gracias| +Invalid Username\/Password|Nombre y contraseña inválidos del usuario| +help.gif|help.gif| +ASTERISK ADMIN: Administration|ASTERISK ADMIN: Administración| +PHONES TABLE|TABLA DE LOS TELÉFONOS| +Phone extension -<\/B> This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP\/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2\/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap\/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone.|Extensión del teléfono - este campo es donde usted pone los nombres del teléfono que aparecen al marcar con asterisco no incluyendo el protocolo o la barra vertical del principio. Por ejemplo: para el teléfono SIP/test101 del SIP la extensión del teléfono sería test101. También, para los teléfonos IAX2 compruebe que usted utiliza el nombre del teléfono completo: IAX2/IAXphone1@IAXphone1 sería IAXphone1@IAXphone1. Para zap los teléfonos compruebe que usted pone el canal completo: Zap/25-1 sería 25-1. Otra nota, compruebe que usted fija el protocolo abajo correctamente para su tipo de teléfono.| +Dialplan number -<\/B> This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server|Número del Dialplan - este campo está para el número que usted marca para tener el anillo del teléfono. Este número se define en el archivo de extensions.conf de su servidor asterisco| +Voicemail Box -<\/B> This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app|Caja de Buzón de Voz - este campo es para la caja del buzón de voz donde van los mensajes para al usuario de este teléfono. Utilizamos esto para comprobar los mensajes del buzón de voz y para que el usuario pueda acceder al Buzón de Voz desde astGUIclient| +Outbound CallerID -<\/B> This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS(non-PRI) T1\/E1s|CallerID de salida - este campo es donde usted incorporara el número del callerID que usted quiera que aparezca en las llamadas de salida. Esto no funciona en las líneas RTB(non-PRI) T1/E1| +Phone IP address -<\/B> This field is for the phone's IP address if it is a VOIP phone. This is an optional field|Dirección IP del teléfono - este campo es para la dirección IP del teléfono si es un teléfono de VOZIP. Este es un campo opcional| +Computer IP address -<\/B> This field is for the user's computer IP address. This is an optional field|Dirección IP del ordenador - este campo es para la dirección IP del ordenador del usuario. Es un campo opcional| +Server IP -<\/B> This menu is where you select which server the phone is active on|IP del servidor - Este menú es donde usted selecciona en que servidor está el teléfono activo| +Login -<\/B> The login used for the phone user to get to admin functions|Login - El nombre de usuario del teléfono para conseguir los permisos de admin| +Password -<\/B> The password used for the phone user to get to admin functions|Contraseña - la contraseña usada por el usuario del teléfono para conseguir los permisos de admin| +Status -<\/B> The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access|Estado - el estado del teléfono en el sistema, puede ser ACTIVO y ADMIN permiten que los clientes del GUI trabajen. ADMIN permite el acceso a este Web site de administración. El resto de los estados no permiten el acceso al GUI o al Web de Admin| +Active Account -<\/B> Whether the phone is active to put it in the list in the GUI client|Cuenta activa - si el teléfono está activado ponerla en la lista del cliente del GUI| +Phone Type -<\/B> Purely for administrative notes|Tipo de teléfono - solamente para información administrativas| +Full Name -<\/B> Used by the GUIclient in the list of active phones|Nombre completo - usado por el GUIclient en la lista de teléfonos activos| +Company -<\/B> Purely for administrative notes|Compañía - solamente para las notas administrativas| +Picture -<\/B> Not yet Implemented|Cuadro - todavía no puesto en ejecución| +New Messages -<\/B> Number of new voicemail messages for this phone on the Asterisk server|Nuevos mensajes - número de los nuevos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco| +Old Messages -<\/B> Number of old voicemail messages for this phone on the Asterisk server|Viejos mensajes - número de los viejos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco| +Client Protocol -<\/B> The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones|Protocolo del cliente - el protocolo que el teléfono utiliza para conectar con el servidor del asterisco: El Sip, IAX2, Zap. También, para los números External remotos o los números SpeedDial que usted desea enumerar como teléfonos| +Local GMT -<\/B> 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 VICIDIAL campaign to accurately display the time and customer time|GMT local - La diferencia a partir del tiempo malo del ZULÚ del time(or de Greenwich) donde se localiza el teléfono. NO AJUSTE POR TIEMPO DE LOS AHORROS DE LA LUZ DEL DÃA. Esto es utilizada por la campaña de VICIDIAL para exhibir exactamente el tiempo y el tiempo del cliente| +Manager Login -<\/B> This is the login that the GUI clients for this phone will use to access the Database where the server data resides|Conexión del encargado - Ésta es la conexión que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor| +Manager Secret -<\/B> This is the password that the GUI clients for this phone will use to access the Database where the server data resides|Secreto del encargado - Ésta es la contraseña que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor| +VICIDIAL Default User -<\/B> This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user|Usuario del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo del usuario de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún usuario| +VICIDIAL Default Pass -<\/B> This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass|Paso del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la contraseña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún paso| +VICIDIAL Default Campaign -<\/B> This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign|Campaña del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la campaña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ninguna campaña| +Park Exten -<\/B> This is the default Parking extension for the client apps. Verify that a different one works before you change this|Parque Exten - Ésta es la extensión del estacionamiento del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto| +Conf Exten -<\/B> This is the default Conference park extension for the client apps. Verify that a different one works before you change this|Conf Exten - Ésta es la extensión del parque de la conferencia del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto| +VICIDIAL Park Exten -<\/B> This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this|Parque Exten de VICIDIAL - Ésta es la extensión del estacionamiento del defecto para el cliente app de VICIDIAL. Verifique que diverso trabaje antes de que usted cambie esto| +VICIDIAL Park File -<\/B> This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters|Archivo del parque de VICIDIAL - éste es el nombre del archivo de la extensión del parque del defecto VICIDIAL para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie éste limitado a 10 caracteres| +Monitor Prefix -<\/B> This is the dialplan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records|Prefijo del monitor - éste es el prefijo dialplan para supervisar de zap los canales automáticamente dentro del app astGUIclient. Cambie solamente según los expedientes de extensiones de extensions.conf ZapBarge| +Recording Exten -<\/B> This is the dialplan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing|Grabación Exten - Ésta es la extensión dialplan para la extensión de la grabación que se utiliza para caer en conferencias del meetme para registrarlas. Dura generalmente hasta que una hora si no parada verifica con el archivo de extensions.conf antes de cambiar| +VMAIL Main Exten -<\/B> This is the dialplan extension going to check your voicemail. verify with extensions.conf file before changing|VMAIL Exten principal - Ésta es la extensión dialplan que va a comprobar su voicemail. verifica con el archivo de extensions.conf antes de cambiar| +VMAIL Dump Exten -<\/B> This is the dialplan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing|Descarga Exten de VMAIL - éste es el prefijo dialplan usado para enviar llamadas directamente al voicemail de un usuario de una llamada viva en el app. astGUIclient verifica con el archivo de extensions.conf antes de cambiar| +Exten Context -<\/B> This is the dialplan context that this phone 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|Contexto de Exten - éste es el contexto dialplan que este teléfono utiliza sobre todo. Se asume que todos los números marcados por los apps del cliente están utilizando este contexto así que es una buena idea cerciorarse de que éste es el contexto más amplio posible verifica con el archivo de extensions.conf antes de cambiar| +DTMF send Channel -<\/B> This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file|DTMF envían el canal - Ésta es la secuencia del canal usada para enviar sonidos de DTMF en conferencias del meetme de los apps del cliente. Verifique que exten y contexto con el archivo de extensions.conf| +Outbound Call Group -<\/B> This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap\/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2\/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file(it is usually what you have defined as the TRUNK global variable at the top of the file)|Grupo de salida de la llamada - éste es el grupo de canal que las llamadas de salida de este teléfono están puestas de. Hay rutinas de un par en los apps del cliente que utilizan esto. Para zap los canales que usted desea utilizar algo como Zap/g2, porque los troncos IAX2 usted desearía utilizar el prefijo completo de IAX como IAX2/VICItest1:secret@10.10.10.15:4569. Verifique que los troncos con el file(it de extensions.conf sean generalmente lo que usted ha definido como la variable global del TRUNK en la tapa del archivo)| +Browser Location -<\/B> This is applicable to only UNIX\/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually|Localización del browser - esto es aplicable solamente a los clientes de UNIX/LINUX, el camino absoluto a Mozilla o el browser de Firefox en la máquina verifica esto lanzándolo manualmente| +Install Directory -<\/B> This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like \/usr\/local\/perl_TK. verify this manually|Instale el directorio - éste es el lugar en donde las escrituras astGUIclient y de astVICIDIAL están situadas en su máquina. Para Win32 debe ser algo como C:\AST_VICI y para UNIX debe ser algo como /usr/local/perl_TK. verifica esto manualmente| +CallerID URL -<\/B> This is the web address of the page used to do custom callerID lookups. default testing address is: http:\/\/astguiclient.sf.net\/test_callerid_output.php|URL de CallerID - Ústa es la dirección de la tela de la página usada para hacer operaciones de búsqueda de encargo del callerID que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_callerid_output.php| +VICIDIAL Default URL -<\/B> This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http:\/\/astguiclient.sf.net\/test_VICIDIAL_output.php|URL del defecto de VICIDIAL - Ésta es la dirección de la tela de la página usada para hacer preguntas de encargo de la forma del Web de VICIDIAL que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_VICIDIAL_output.php| +Call Logging -<\/B> This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hangup 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly|Registración de la llamada - esto se fija para verdad si el archivo de call_log.agi está en lugar en el archivo de extensions.conf para todo el de salida y las extensiones del retraso ' h ' para registrar todo llama. Ústa debe siempre ser 1 porque es manditory para muchos astGUIclient y características de VICIDIAL a trabajar correctamente| +User Switching -<\/B> Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation|Conmutación del usuario - fije para verdad para permitir que el usuario cambie a otra cuenta del usuario. NOTA: Si los interruptores del usuario ellos pueden iniciar la grabación en la conversación de teléfono del nuevo usuario| +Conferencing -<\/B> Set to true to allow user to start conference calls with upto six external lines|Comunicación - fije para verdad para permitir que el usuario comience llamadas de conferencia con hasta que seis líneas externas| +Admin Hangup -<\/B> Set to true to allow user to be able to hangup any line at will through astGUIclient. Good idea only to enable this for Admin users|Retraso del Admin - sistema a verdad para permitir que el usuario pueda al retraso cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin| +Admin Hijack -<\/B> Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers|Secuestro del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados| +Admin Monitor -<\/B> Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool|Monitor del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados y como herramienta del entrenamiento| +Call Park -<\/B> Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hangup. Usually enabled for all|Parque de llamada - el sistema a verdad para permitir que el usuario pueda parquear invita el asimiento astGUIclient para ser tomado por cualquier otro usuario astGUIclient en el sistema. Las llamadas permanecen en el asimiento para hasta que un retraso de la media-hora entonces. Permitido generalmente para todos| +Updater Check -<\/B> Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users|Cheque de Updater - fije para verdad para exhibir una advertencia del popup que el tiempo del updater no ha cambiado en 20 segundos. Útil para los usuarios del Admin| +AF Logging -<\/B> Set to true to log many actions of astGUIclient usage to a text file on the user's computer|Af que registra - fije para verdad para registrar muchas acciones del uso astGUIclient a un archivo de texto en la computadora del usuario| +Queue Enabled -<\/B> Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users|La coleta permitió - al sistema verdad para hacer que los apps del cliente utilicen el sistema central de la coleta del asterisco. Requerido para VICIDIAL y recomendado para todos los usuarios| +CallerID Popup -<\/B> Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users|CallerID Popup - sistema a verdad para tener en cuenta los números definidos en el archivo de extensions.conf para enviar las pantallas del popup de CallerID a los usuarios astGUIclient| +VMail Button -<\/B> Set to true to display the VOICEMAIL button and the messages count display on astGUIclient|Botón de VMail - fije para verdad para exhibir el botón de VOICEMAIL y los mensajes cuentan la exhibición en astGUIclient| +Fast Refresh -<\/B> Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms (1 second). Can increase system load if you lower this number|Rápido restaure - fije para verdad para permitir un nuevo índice de restauran de la información de la llamada para el astGUIclient. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número| +Fast Refresh Rate -<\/B> in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms (1 second). Can increase system load if you lower this number|Rápido restaure la tarifa - en milisegundos. Utilizado solamente si es rápido restaure se permite. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número| +Persistant MySQL -<\/B> If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine|Persistant MySQL - si está permitida la conexión astGUIclient seguirá conectada en vez de conectar cada segundo. Útil si usted hace que un rápido restaure la tarifa fijada. Aumentará el número de conexiones en su máquina de MySQL| +Auto Dial Next Number -<\/B> If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen|Número siguiente del dial auto - si está permitido el cliente de VICIDIAL marcará el número siguiente en la lista automáticamente sobre la disposición de una llamada a menos que seleccionaran "para parar el marcar" en la pantalla de la disposición| +Stop Rec after each call -<\/B> If enabled the VICIDIAL client 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|Pare Rec después de cada llamada - si está permitido el cliente de VICIDIAL parará se está encendiendo cualquier grabación después de que haya sido cada llamada dispositioned. Útil si usted está haciendo muchos de la grabación o usted están utilizando una forma de la tela para accionar la grabación| +DBX Server -<\/B> The MySQL database server that this user should be connecting to|Servidor de DBX - el servidor de la base de datos de MySQL con el cual este usuario debe conectar| +DBX Database -<\/B> The MySQL database that this user should be connecting to. Default is asterisk|Base de datos de DBX - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco| +DBX User -<\/B> The MySQL user login that this user should be using when connecting. Default is cron|Usuario de DBX - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron| +DBX Pass -<\/B> The MySQL user password that this user should be using when connecting. Default is 1234|Paso de DBX - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234| +DBX Port -<\/B> The MySQL TCP port that this user should be using when connecting. Default is 3306|DBX viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306| +DBY Server -<\/B> The MySQL database server that this user should be connecting to|Servidor de DBY - el servidor de la base de datos de MySQL con el cual este usuario debe conectar| +DBY Database -<\/B> The MySQL database that this user should be connecting to. Default is asterisk|Base de datos de DBY - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco| +DBY User -<\/B> The MySQL user login that this user should be using when connecting. Default is cron|Usuario de DBY - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron| +DBY Pass -<\/B> The MySQL user password that this user should be using when connecting. Default is 1234|Paso de DBY - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234| +DBY Port -<\/B> The MySQL TCP port that this user should be using when connecting. Default is 3306|DBY viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306| +Redirect command sent for channel|Vuelva a dirigir el comando enviado para el canal| +Look up this customer in Customer Service System|Mire para arriba a este cliente en sistema del servicio de cliente| +Redirect command FAILED for channel|Vuelva a dirigir el comando FALLADO para el canal| +PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT|SELECCIONE POR FAVOR Un NÚMERO Y La FECHA ARRIBA Y El TECLEO SOMETEN| +Total Calls That came into this number|Llamadas totales que vinieron en este número| +Average Call Length(seconds) for all Calls|La llamada media Length(seconds) para toda llama| +Total DROP Calls: (less than 10 seconds)|Llamadas Totales de la GOTA: (menos de 10 segundos)| +Average Call Length(seconds) for DROP Calls|Llamada media Length(seconds) para las llamadas de la GOTA| +GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS|GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LLAMADAS TOTALES| +Click on the channel below that you would like to have directed to your phone|Chasque encendido el canal debajo de ése que usted quisiera haber dirigido a su teléfono| +LAST 1000 CALLS FOR DATE RANGE|LLAMADAS DEL ÚLTIMO 1000 PARA LA GAMA DE LA FECHA| +Click here to see what leads are in the hopper right now|Chasque aquí para ver qué plomos están en la tolva ahora| +CUSTOM STATUSES WITHIN THIS CAMPAIGN|ESTADOS DE ENCARGO DENTRO DE ESTA CAMPAÚA| +PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT|SELECCIONE POR FAVOR Una CAMPAÚA ARRIBA Y El TECLEO SOMETE| +PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT|SELECCIONE POR FAVOR Una CAMPAÚA Y La FECHA ARRIBA Y El TECLEO SOMETEN| +GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN|GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LAS LLAMADAS TOTALES PUESTAS DE ESTA CAMPAÚA| +ERROR: The file does not have the required number of fields to process it|ERROR: El archivo no tiene el número requerido de los campos para procesarlo| +ERROR: File exceeds the 8MB limit|ERROR: El archivo excede el límite 8MB| +Please enter the group you want to get hourly stats for|Inscriba por favor a grupo que usted desea conseguir el stats cada hora para| +The search variables you entered are not active in the system|Las variables de la búsqueda que usted incorporó no son activas en el sistema| +Please go back and double check the information you entered and submit again|Va por favor detrás y dobla el cheque la información que usted incorporó y somete otra vez| +Click here to see the Lead Details|Chasque aquí para ver los detalles del plomo| +SERVERS TABLE|TABLA DE LOS SERVIDORES| +Server ID -<\/B> This field is where you put the Asterisk server's name, doesn't have to be an official domain sub, just a nickname to identify the server to Admin users|Server ID - This field is where you put the Asterisk server's name, doesn't have to be an official domain sub, just a nickname to identify the server to Admin users| +Server Description -<\/B> The field where you use a small phrase to describe the Asterisk server|Descripción del servidor - el campo donde usted utiliza una frase pequeña para describir el servidor del asterisco| +Server IP Address -<\/B> The field where you put the Network IP address of the Asterisk server|IP address del servidor - el campo donde usted puso el IP address de la red del servidor del asterisco| +Active -<\/B> Set whether the Asterisk server is active or inactive|Activo - fije si el servidor del asterisco es activo o inactivo| +Asterisk Version -<\/B> Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local\/ channels(a bug that has been fixed in CVS v1.0) and need to be treated differently when handling their Local\/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well|Versión del asterisco - fije la versión del asterisco que usted ha instalado en este servidor. Ejemplos: ' 1.2 ', ' 1.0.8 ', ' 1.0.7 ', ' CVS_HEAD ', ' REALMENTE VIEJO ', etc... Se utiliza esto porque las versiones 1.0.8 y 1.0.9 tienen un diverso método de ocuparse del insecto local del channels(a que ha estado fijado en CVS v1.0) y necesidad de ser tratado diferentemente cuando la manipulación de su Local/ acanala. También, CVS_HEAD actual y las 1.2 aplicaciones diverso encargado y comando del árbol del lanzamiento hicieron salir así que debe ser tratado diverso también| +Max VICIDIAL Trunks -<\/B> This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96|Troncos máximos de VICIDIAL - este campo determinará el número de las líneas máximo que el auto-dialer de VICIDIAL procurará invitar este servidor. Si usted desea dedicar dos PRI llenos T1 a VICIDIALing en un servidor entonces usted fijaría esto a 46. E1 defecto es 96| +Telnet Host -<\/B> This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine|Anfitrión del telnet - éste es la dirección o el nombre del servidor del asterisco y es cómo los usos del encargado conectan con él de donde están funcionando. Si están funcionando en el servidor del asterisco, después el defecto del ' localhost ' está muy bien| +Telnet Port -<\/B> This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install|El telnet vira hacia el lado de babor - éste es el puerto de la conexión del encargado del servidor del asterisco y es cómo los usos del encargado conectan con ella de donde están funcionando. El defecto de ' 5038 ' está para un estándar instala muy bien| +Manager User -<\/B> The username or login used to connect genericly to the Asterisk server manager. Default is 'cron'|Usuario del encargado - el username o la conexión conectaba genericly con el encargado del servidor del asterisco. El defecto es 'cron'| +Manager Secret -<\/B> The secret or password used to connect genericly to the Asterisk server manager. Default is '1234'|Secreto del encargado - el secreto o la contraseña conectaba genericly con el encargado del servidor del asterisco. El defecto es '1234'| +Manager Update User -<\/B> The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user|Usuario en modo actualización del encargado - el username o la conexión conectaba con el encargado del servidor del asterisco optimizado para las escrituras de la actualización. Omita es 'updatecron' y asume el mismo secreto que el usuario genérico| +Manager Listen User -<\/B> The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user|El encargado escucha usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que esperan a escuchar solamente salida. Omita es 'listencron' y asume el mismo secreto que el usuario genérico| +Manager Send User -<\/B> The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user|El encargado envía a usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que envían solamente acciones al encargado. Omita es 'sendcron' y asume el mismo secreto que el usuario genérico| +Server GMT offset -<\/B> The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5'|El GMT del servidor compensó - la diferencia sobre horas a partir del tiempo del GMT no ajustado según el Luz del di'a-Ahorro-Tiempo del servidor. El defecto es '-5'| +VMail Dump Exten -<\/B> The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666'|Descarga Exten - el prefijo de VMail de la extensión usado en este servidor para enviar llamadas directamente a través de agc a una caja específica del voicemail. El defecto es '85026666666666'| +VICIDIAL AD extension -<\/B> The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365'|Extensión del ANUNCIO de VICIDIAL - la extensión del defecto si ninguno está presente en la campaña enviar llamadas para a marcar auto de VICIDIAL. El defecto es '8365'| +Default Context -<\/B> The default dialplan context used for scripts that operate for this server. Default is 'default'|Contexto del defecto - el contexto dialplan del defecto usado para las escrituras que funcionan para este servidor. El defecto es 'defecto'| +User ID -<\/B> This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length|Identificación del usuario - este campo es donde usted pone el número de la identificación del usuario de VICIDIAL, puede ser hasta 8 dígitos en longitud, debe ser por lo menos 2 caracteres en longitud| +Password -<\/B> This field is where you put the VICIDIAL users password. Must be at least 2 characters in length|Contraseña - este campo es donde usted pone la contraseña de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud| +Full Name -<\/B> This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length|Nombre completo - este campo es donde usted pone el nombre completo de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud| +User Level -<\/B> This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, 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|Nivel de usuario - este menú es donde usted selecciona el nivel de usuario de los usuarios de VICIDIAL. Debe ser un nivel de 1 a registrar en VICIDIAL, debe ser llano mayor de 2 a abrirse una sesión como más cercano, deben ser el nivel de usuario 8 o mayor conseguir en la sección de la tela del admin| +User Group -<\/B> This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it|Grupo de usuario - este menú es donde usted selecciona a grupo de usuarios de VICIDIAL que este usuario pertenecerá a. Esto no tiene ninguna restricciones en este tiempo, éste es justo subdividir a usuarios y permitir las características futuras basadas sobre él| +Campaign ID -<\/B> This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in lengt|Identificación de la campaña - Úste es el nombre corto de la campaña, él no es editable después de la sumisión inicial, no puede contener espacios y debe estar entre 2 y 8 caracteres en longitud| +Campaign Name -<\/B> This is the description of the campaign, it must be between 6 and 40 characters in length|Nombre de la campaña - Ésta es la descripción de la campaña, debe estar entre 6 y 40 caracteres en longitud| +Active -<\/B> This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it|Activo - aquí es adonde usted fija la campaña a activo o a inactivo. Si es inactivo, noone puede registrar en él| +Park Extension -<\/B> This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below|Extensión del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que la extensión esté en lugar en el extensions.conf y eso que señala al nombre de fichero abajo| +Park File Name -<\/B> This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory|Nombre del archivo del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que el nombre de fichero sea 10 caracteres en longitud o menos y que el archivo está en lugar en el directorio de /var/lib/asterisk/sounds| +Web Form -<\/B> This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button|Forma del Web - aquí es donde usted puede fijar el Web page de encargo que será abierto cuando el usuario chasca encendido el botón de la FORMA del WEB| +Allow Closers -<\/B> This is where you can set whether the users of this campaign will have the option to send the call to a closer|Permita Closers - aquí es donde usted puede fijar si los usuarios de esta campaña tendrán la opción para enviar la llamada a un más cercano| +Dial Status -<\/B> This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below|Estado del dial - aquí es adonde usted fija los estados que usted está deseando marcar encendido dentro de las listas que son activas para la campaña abajo| +List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper|Orden de la lista - Este menú es donde usted selecciona cómo los plomos que emparejan los estados seleccionados arriba serán puestos en la tolva del plomo| +select the first leads loaded into the vicidial_list table|seleccione los primeros plomos cargados en la tabla del vicidial_list| +select the last leads loaded into the vicidial_list table|seleccione los plomos pasados cargados en la tabla del vicidial_list| +select the highest phone number and works its way down|seleccione el número y los trabajos más altos de teléfono su manera abajo| +select the lowest phone number and works its way up|seleccione el número y los trabajos más bajos de teléfono su manera para arriba| +starts with last names starting with Z and works its way down|comienzo con los nombres pasados comenzando con Z y trabajos su manera abajo| +starts with last names starting with A and works its way up|comienzo con los nombres pasados comenzando con A y trabajos su manera para arriba| +starts with most called leads and works its way down|comienzo con los plomos y los trabajos llamados su manera abajo| +starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses|comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada otro lead(Must para no tener NEW seleccionado en los estados del dial)| +starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses|comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada tercer lead(Must para no tener NEW seleccionado en los estados del dial)| +starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses|comienzo con menos plomos y trabajos llamados que su manera para arriba que inserta un NEW plomo en cada adelante conduzca (no debe tener NEW seleccionado en los estados del dial)| +starts with least called leads and works its way up|comienzo con menos plomos y trabajos llamados su manera para arriba| +Hopper Level -<\/B> This is how many leads the VDhopper script tries to keep in the vicidial_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|Tolva llana - éste es cuántos conducen los intentos de la escritura de VDhopper para mantener la tabla del vicidial_hopper para esta campaña. Si funciona la escritura de VDhopper cada minuto, haga esto levemente mayor que el número de plomos que usted entra a través en un minuto| +Force Reset of Hopper -<\/B> This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs|Reajuste de la fuerza de la tolva - esto permite que usted limpie fuera del contenido de la tolva sobre la sumisión de la forma. Debe ser llenada otra vez cuando la escritura de VDhopper funciona| +Auto Dial Level -<\/B> This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL 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|Nivel auto del dial - aquí es adonde usted fija cuántos alinea VICIDIAL debe utilizar por medios del agente activo cero 0 que el marcar del automóvil está apagado y los agentes chascarán para marcar cada número. Si no VICIDIAL mantendrá líneas que marcan iguales a los agentes activos multiplicados por el nivel del dial para llegar cuántas líneas debe permitir esta campaña en cada servidor| +Next Agent Call -<\/B> This determines which agent receives the next call that is available|Llamada siguiente del agente - esto se determina qué agente recibe la llamada siguiente que está disponible| +orders by the random update value in the vicidial_live_agents table|órdenes por el valor al azar de la actualización en la tabla de los vicidial_live_agents| +orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall|las órdenes por la vez última un agente fueron enviadas una llamada. Resultados en los agentes que reciben el número casi igual de llamadas cabalmente| +orders by the last time an agent finished a call. AKA agent waiting longest receives first call|las órdenes por la vez última un agente acabaron una llamada. El agente de AKA que espera lo más de largo posible recibe la primera llamada| +Local Call Time -<\/B> This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm|Tiempo de la llamada local - aquí es adonde usted fijó durante qué horas usted quisiera marcar, según lo determinado por el tiempo local en está en cuál usted está llamando. Esto es controlada por código de área y ajustada por tiempo de los ahorros de la luz del día si es aplicable. Las pautas generales en los E.E.U.U. para el negocio al negocio son los 9am a los 5pm y el negocio a las llamadas del consumidor es los 9am a los 9pm| +Voicemail -<\/B> If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message|Voicemail - si estuvieron definidas, las llamadas que CAERÃAN normalmente en lugar de otro serían ordenadas a esta caja del voicemail para oír y para dejar un mensaje| +Dial Timeout -<\/B> If defined, calls that would normally hangup after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve|Descanso del dial - si está definido, llamadas que normalmente retraso después de que el descanso definido en extensions.conf en lugar de otro descanso en esta cantidad de segundos si es menos que el descanso de extensions.conf. Esto permite descansos del dial rápidamente que cambian del servidor al servidor y a limitar los efectos a una sola campaña. Si usted está teniendo muchos de llamadas del contestador automático o de Voicemail usted puede desear intentar cambiar este valor entre a 21-26 y ver si los resultados mejoran| +Dial Prefix -<\/B> This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dialplan - extensions.conf|Prefijo del dial - este campo permite más fácilmente cambiar una trayectoria de marcar a salir con un diverso método sin hacer una recarga en asterisco. El defecto es 9 basados sobre un 91NXXNXXXXXX en el dialplan - extensions.conf| +Campaign CallerID -<\/B> 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. This option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on. This feature may also work with IAX2 trunks depending on what your provider allows. The custom callerID only applies to calls placed for the VICIDIAL 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|Campaña CallerID - este campo permite enviar de un número de encargo del callerid en las llamadas de salida. Úste es el número que demostraría para arriba en el callerid de la persona que usted está llamando. El defecto es DESCONOCIDO. Esta opción está solamente disponible si usted está utilizando PRIs - ISDN T1 o E1 - que tienen la característica de encargo del callerid se giraron. Esta característica puede también trabajar con los troncos IAX2 dependiendo de lo que admite su abastecedor. El callerID de encargo se aplica solamente a las llamadas puestas para la campaña de VICIDIAL directamente, cualquier tercer persona llama o las transferencias no enviarán el callerID de encargo. NOTA: A veces el poner DESCONOCIDO o PRIVADO en el campo rendirá enviar de su número del callerID del defecto por su portador con las llamadas. Usted puede desear probar esto y poner 0000000000 en el campo del callerid en lugar de otro si usted no desea enviarle CallerID| +Campaign VDAD extension -<\/B> This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States|Extensión de la campaña VDAD - este campo permite una extensión de la transferencia del costumbre VDAD. Esto permite que usted utilice diversas escrituras del agi de VDADtransfer... dependiendo de su campaña. La transferencia AGI(exten 8365 agi-VDADtransfer.agi del defecto) apenas envía inmediatamente invita a los agentes tan pronto como él se tome. Una encuesta sobre política AGI la muestra adicional es también (8366 agi-VDADtransferSURVEY.agi ) ese ahora incluido los juegos un mensaje a la persona llamada y permite que él haga una opción presionando buttons(effectively la pre-investigacio'n el plomo). Observe por favor eso a excepción de los exámenes, llamadas políticas y las caridades esta forma de llamar son ilegales en los Estados Unidos| +List ID -<\/B> This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length|Identificación de la lista - Úste es el nombre numérico de la lista, él no es editable después de la sumisión inicial, debe contener solamente números y debe estar entre 2 y 8 caracteres en longitud| +List Name -<\/B> This is the description of the list, it must be between 2 and 20 characters in length|Nombre de la lista - Ésta es la descripción de la lista, debe estar entre 2 y 20 caracteres en longitud| +Campaign -<\/B> This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time|Campaña - Ésta es la campaña que esta lista pertenece a. Una lista se puede marcar solamente en una sola campaña contemporáneamente| +Active -<\/B> This defines whether the list is to be dialed on or not|Activo - esto define si la lista debe ser marcada encendido o no| +Reset Lead-Called-Status for this list -<\/B> This resets all leads in this list to N for \"not called since last reset\" and means that any lead can now be called if it is the right status as defined in the campaign screen|Reajuste el Conducir-Llamar-Estado para esta lista - esto reajusta todos los plomos en esta lista a N para "no llamado puesto que reajuste pasado" y significa que cualquier plomo puede ahora ser llamado si es el estado derecho según lo definido en la pantalla de la campaña| +Group ID -<\/B> This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length|Identificación de grupo - Úste es el nombre corto del grupo de entrada, él no es editable después de la sumisión inicial, no debe contener cualquier espacio y debe estar entre 2 y 20 caracteres en longitud| +Group Name -<\/B> This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces|Nombre de grupo - Ésta es la descripción del grupo, debe estar entre 2 y 30 caracteres en longitud. No puede incluir rociadas -, plusses + o espacios| +Group Color -<\/B> This is the color that displays in the VICIDIAL 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 VICIDIAL will not work properly|Color del grupo - éste es el color que exhibe en el cliente app de VICIDIAL cuando una llamada viene adentro en este grupo. Debe estar entre 2 y 7 caracteres de largo. Si esto es una definición del color de la tuerca hexagonal usted debe recordar poner a # al principio de la secuencia o VICIDIAL no trabajará correctamente| +Active -<\/B> This determines whether this group show up in the selection box when a VICIDIAL agent logs in|Activo - esto se determina si este grupo demuestra para arriba en la caja de la selección cuando un agente de VICIDIAL entra| +Web Form -<\/B> This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group|Forma del Web - Ésta es la dirección de encargo que el chascar en el botón de la FORMA del WEB en VICIDIAL le llevará para las llamadas que vienen adentro en este grupo| +Voicemail -<\/B> If defined, this is the Voicemail box that calls will go to instead of being dropped if no agents are available after the hold time is up|Voicemail - si está definida, Ésta es la caja de Voicemail que las llamadas irán en vez a ser caído si no hay agentes disponibles después del tiempo de asimiento están para arriba| +Fronter Display -<\/B> This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent|Exhibición de Fronter - este campo se determina si el agente de entrada de VICIDIAL tendría el name(if del fronter allí es uno) exhibido en el campo del estado cuando la llamada viene al agente| +User ID Start -<\/B> 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 VICIDIAL 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|Comienzo de la identificación del usuario - Ésta es la identificación del usuario que comienza se utiliza que cuando las entradas alejadas del agente se insertan en el sistema. Si el número de líneas se fija más altamente de 1, este número es incrementado por uno hasta que cada línea tiene una entrada. Se cerciora de usted crear una nueva cuenta del usuario de VICIDIAL con un nivel de usuario de 4 o grande si usted quisiera que pudieran utilizar la página de vdremote.php para el acceso alejado de la tela de esta cuenta| +Number of Lines -<\/B> This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below|Número de líneas - el define cuánto crea el agente alejado las entradas el sistema, y se determina cuántas líneas piensa que puede enviar con seguridad al número debajo| +Server IP -<\/B> A remote agent entry is only good for one specific server, here is where you select which server you want|IP del servidor - Una entrada alejada del agente es solamente buena para un servidor específico, aquí es donde usted selecciona a que el servidor usted desea| +External Extension -<\/B> This is the number that you want the calls forwarded to. Make sure that it is a full dialplan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system|Extensión externa - éste es el número que usted desea las llamadas remitidas a. Cerciórese de que sea un número dialplan completo y que si usted necesita 9 al principio usted lo pone adentro aquí. Pruebe marcando este número de un teléfono en el sistema| +Status -<\/B> Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls|Estado - aquí es donde usted da vuelta al agente alejado por intervalos. Tan pronto como el agente sea activo el sistema asume que puede enviarle llamadas. Puede tomar hasta 30 segundos una vez que usted cambie el estado a inactivo para parar el recibir de llamadas| +Campaign -<\/B> Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from|Campaña - aquí es donde usted selecciona la campaña que estos agentes alejados serán registrados en. Necesidades de entrada de utilizar la campaña MÃS CERCANA y de seleccionar las campañas de entrada debajo de ésa que usted desea recibir llamadas de| +Inbound Groups -<\/B> Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign|Grupos de entrada - aquí es donde usted selecciona a grupos de entrada que usted desea recibir llamadas de si usted ha seleccionado la campaña MÃS CERCANA| +The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column|Las listas dentro de esta campaña se enumeran aquí, si son activas son denotadas por la Y o N y usted pueden ir a la pantalla de la lista chascando en la identificación de la lista en la primera columna| +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 VICIDIAL as a disposition|Con el uso de los estados de encargo de la campaña, usted puede tener estados que existan solamente para una campaña específica. El estado debe ser 1-8 caracteres en longitud, la descripción debe ser 2-30 caracteres en longitud y seleccionable define si demuestra para arriba en VICIDIAL como disposición| +Through the use of custom campaign hotkeys, agents that use the vicidial web-client can hangup and disposition calls just by pressing a single key on their keyboard|Con el uso de los hotkeys de encargo de la campaña, los agentes que utilizan el retraso vicidial de la lata del tela-cliente y la disposición llama apenas presionando una sola llave en su teclado| +User Group -<\/B> This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters|Grupo de usuario - éste es el nombre corto de un grupo de usuario de Vicidial, intento para no utilizar ningunos espacios o puntuación para los caracteres de este máximo 20 del campo, mínimo de 2 caracteres| +Group Name -<\/B> This is the description of the vicidial user group max of 40 characters|Nombre de grupo - Ésta es la descripción del máximo vicidial del grupo de usuario de 40 caracteres| +VICIDIAL LIST LOADER FUNCTIONALITY|FUNCIONALIDAD DEL CARGADOR DE LA LISTA DE VICIDIAL| +The VICIDIAL 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 vicidial_list table. The lead loader does not do data validation or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files|El VICIDIAL tela-baso' cargador del plomo se diseña simplemente llevar un file(up del plomo 8MB de tamaño) que es lengüeta o pipa delimitada y cargarlo en la tabla del vicidial_list. El cargador del plomo no hace la validación de datos o la comprobación para duplicados en sí mismo u otras listas, de modo que esté algo usted necesita hacer antes de usted la carga los plomos. También, cerciórese de que usted haya creado la lista que estos plomos son estar debajo de modo que usted pueda utilizarlos. Hay también la materia de la tiempo-zona-codificacio'n estos plomos. Usted puede desear aumentar la frecuencia que el ADMIN_adjust_GMTnow_on_leads.pl se está funcionando en el cron en su servidor del asterisco para poder cifrar cualquier plomo cargado más rápidamente. Aquí está una lista de los campos en su orden apropiada para los archivos del plomo| +Vendor Lead Code - shows up in the Vendor ID field of the GUI|Código del plomo del vendedor - demuestra para arriba en el campo de la identificación del vendedor del GUI| +Source Code - internal use only for admins and DBAs|Código de fuente - uso interno solamente para los admins y DBAs| +List ID - the list number that these leads will show up under|Identificación de la lista - el número de la lista que estos plomos demostrarán para arriba debajo| +Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc|Código del teléfono - el prefijo para el teléfono number(1 para los E.E.U.U., 01144 para Reino Unido, 01161 para AUS, el etc)| +Phone Number - must be at least 8 digits long|Número de teléfono - debe ser por lo menos 8 dígitos de largo| +Title - title of the customer - Mr. Ms. Mrs, etc...|Título - título del customer(Mr. Ms señ., etc...)| +NOTE: It can take up to 30 seconds for changes submitted on this screen to go live|NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva| +USER NOT ADDED - there is already a user in the system with this user number|USUARIO NO AGREGADO - hay ya un usuario en el sistema con este número del usuario| +USER NOT ADDED - Please go back and look at the data you entered|USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +user id must be between 2 and 8 characters long|la ID del usuario debe estar entre 2 y 8 caracteres de largo| +full name and password must be at least 2 characters long|el nombre completo y la contraseña deben ser por lo menos 2 caracteres de largo| +CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID|CAMPAÚA NO AGREGADA - hay ya una campaña en el sistema con esta identificación| +CAMPAIGN NOT ADDED - Please go back and look at the data you entered|CAMPAÚA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó| +campaign ID must be between 2 and 8 characters in length|la ID de la campaña debe estar entre 2 y 8 caracteres en longitud| +campaign name must be between 6 and 40 characters in length|el nombre de la campaña debe estar entre 6 y 40 caracteres en longitud| +CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name|ESTADO de la CAMPAÚA - hay ya una campaña - estado NO AGREGADO en el sistema con este nombre| +CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name|ESTADO de la CAMPAÚA NO AGREGADO - hay ya un global-estado en el sistema con este nombre| +CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered|ESTADO de la CAMPAÚA NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +status must be between 1 and 8 characters in length|el estado debe estar entre 1 y 8 caracteres en longitud| +status name must be between 2 and 30 characters in length|el nombre del estado debe estar entre 2 y 30 caracteres en longitud| +CAMPAIGN HOTKEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey|CAMPAÚA HOTKEY NO AGREGADA - hay ya una campaña-hotkey en el sistema con este hotkey| +CAMPAIGN HOTKEY NOT ADDED - Please go back and look at the data you entered|CAMPAÚA HOTKEY NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó| +hotkey must be a single character between 1 and 9|el hotkey debe ser un solo carácter entre 1 y 9| +LIST NOT ADDED - there is already a list in the system with this ID|LISTA NO AGREGADA - hay ya una lista en el sistema con esta ID| +LIST NOT ADDED - Please go back and look at the data you entered|LISTA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó| +List ID must be between 2 and 8 characters in length|La ID de la lista debe estar entre 2 y 8 caracteres en longitud| +List name must be at least 2 characters in length|El nombre de la lista debe ser por lo menos 2 caracteres en longitud| +GROUP NOT ADDED - there is already a group in the system with this ID|GRUPO NO AGREGADO - hay ya un grupo en el sistema con esta ID| +GROUP NOT ADDED - Please go back and look at the data you entered|GRUPO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +Group ID must be between 2 and 20 characters in length and contain no|La ID de grupo debe estar entre 2 y 20 caracteres en longitud y contener no| +Group name and group color must be at least 2 characters in length|El color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud| +REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID|AGENTES ALEJADOS NO AGREGADOS - hay ya una entrada alejada de los agentes comenzando con esta ID del usuario| +REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered|AGENTES ALEJADOS NO AGREGADOS - vaya por favor detrás y mire los datos que usted incorporó| +User ID start and external extension must be at least 2 characters in length|El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud| +USER GROUP NOT ADDED - there is already a user group entry with this name|GRUPO de USUARIO NO AGREGADO - hay ya una entrada del grupo de usuario con este nombre| +USER GROUP NOT ADDED - Please go back and look at the data you entered|GRUPO de USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +Group name and description must be at least 2 characters in length|El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud| +USER NOT MODIFIED - Please go back and look at the data you entered|USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +Password and Full Name each need ot be at least 2 characters in length|La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud| +CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered|CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó| +the campaign name needs to be at least 6 characters in length|el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud| +RESETTING CAMPAIGN LEAD HOPPER|REAJUSTE DE LA TOLVA DEL PLOMO DE LA CAMPAÚA| +Wait 1 minute before dialing next number|Espera 1 minuto antes de marcar el número siguiente| +CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered|ESTADO de la CAMPAÚA NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +the campaign id needs to be at least 2 characters in length|la ID de la campaña necesita ser por lo menos 2 caracteres en longitud| +the campaign status needs to be at least 1 characters in length|el estado de la campaña necesita ser por lo menos los caracteres 1 en longitud| +CUSTOM CAMPAIGN STATUS DELETED|ESTADO DE ENCARGO DE LA CAMPAÚA SUPRIMIDO| +CAMPAIGN HOTKEY NOT MODIFIED - Please go back and look at the data you entered|CAMPAÚA HOTKEY NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó| +the campaign hotkey needs to be at least 1 characters in length|el hotkey de la campaña necesita ser por lo menos los caracteres 1 en longitud| +CUSTOM CAMPAIGN HOTKEY DELETED|LA CAMPAÚA DE ENCARGO HOTKEY SUPRIMIÚ| +CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered|CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó| +the campaign name needs to be at least 6 characters in length|el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud| +LIST NOT MODIFIED - Please go back and look at the data you entered|LISTA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó| +list name must be at least 2 characters in length|el nombre de la lista debe ser por lo menos 2 caracteres en longitud| +REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER|QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA| +GROUP NOT MODIFIED - Please go back and look at the data you entered|GRUPO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +group name and group color must be at least 2 characters in length|el color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud| +REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered|AGENTES ALEJADOS NO MODIFICADOS - vaya por favor detrás y mire los datos que usted incorporó| +User ID Start and External Extension must be at least 2 characters in length|El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud| +REMOTE AGENTS MODIFIED|LOS AGENTES ALEJADOS SE MODIFICARON| +USER GROUP NOT MODIFIED - Please go back and look at the data you entered|GRUPO de USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +Group name and description must be at least 2 characters in length|El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud| +MODIFY A USERS RECORD|MODIFIQUE Un EXPEDIENTE De los USUARIOS| +Click here for user stats|Clique aquí para ver las estadísticas del usuario| +MODIFY A CAMPAIGNS RECORD|MODIFIQUE Un EXPEDIENTE De las CAMPAÚAS| +CONFERENCES TABLE|TABLA DE CONFERENCIAS| +Conference Number -<\/B> This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL|Número de la conferencia - este campo es donde usted pone el número del dialpna de la conferencia del meetme. También se recomienda que el número del meetme en meetme.conf empareja este número para cada entrada. Esto está para las conferencias en astGUIclient y se utiliza para la funcionalidad de leave-3way-call en VICIDIAL| +Server IP -<\/B> The menu where you select the Asterisk server that this conference will be on|IP del servidor - El menú donde usted selecciona el servidor del asterisco que esta conferencia estará encendido| +PHONE NOT ADDED - there is already a Phone in the system with this extension\/server|TELÉFONO NO AGREGADO - hay ya un teléfono en el sistema con esta extensión/servidor| +PHONE NOT ADDED - Please go back and look at the data you entered|TELÉFONO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +PHONE ADDED|EL TELÉFONO AGREGÚ| +SERVER NOT ADDED - there is already a server in the system with this ID|SERVIDOR NO AGREGADO - hay ya un servidor en el sistema con esta identificación| +SERVER NOT ADDED - Please go back and look at the data you entered|SERVIDOR NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó| +SERVER ADDED|SERVIDOR AGREGADO| +CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server|CONFERENCIA NO AGREGADA - hay ya una conferencia en el sistema con esta identificación y servidor| +CONFERENCE NOT ADDED - Please go back and look at the data you entered|CONFERENCIA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó| +CONFERENCE ADDED|LA CONFERENCIA AGREGÚ| +PHONE NOT MODIFIED - there is already a Phone in the system with this extension\/server|TELÉFONO NO MODIFICADO - hay ya un teléfono en el sistema con esta extensión/servidor| +PHONE NOT MODIFIED - Please go back and look at the data you entered|TELÉFONO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +PHONE MODIFIED|TELÉFONO MODIFICADO| +SERVER NOT MODIFIED - there is already a server in the system with this server_ip|SERVIDOR NO MODIFICADO - hay ya un servidor en el sistema con este server_ip| +SERVER NOT MODIFIED - Please go back and look at the data you entered|SERVIDOR NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó| +SERVER MODIFIED|SERVIDOR MODIFICADO| +CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server|CONFERENCIA - hay ya una conferencia en el sistema con esta extensión - servidor NO MODIFICADO| +CONFERENCE NOT MODIFIED - Please go back and look at the data you entered|CONFERENCIA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó| +CONFERENCE MODIFIED|CONFERENCIA MODIFICADA| +MODIFY A PHONE RECORD|MODIFICANDO EL TELÉFONO| +THE END|EL EXTREMO| +LIST ALL PHONES|ENUMERE TODOS LOS TELÉFONOS| +ADD A NEW PHONE|AGREGUE Un TELÉFONO NUEVO| +SEARCH FOR A PHONE|BÚSQUEDA PARA Un TELÉFONO| +ADD A SERVER|AGREGUE Un SERVIDOR| +LIST ALL SERVERS|ENUMERE TODOS LOS SERVIDORES| +SHOW ALL CONFERENCES|DEMUESTRE TODAS LAS CONFERENCIAS| +ADD A NEW CONFERENCE|AGREGUE Una NUEVA CONFERENCIA| +Phone extension|Extensión del teléfono| +Dialplan Number|Número De Dialplan| +digits only|Solamente dígitos| +Voicemail Box|Buzón de voz| +Outbound CallerID|CallerID De salida| +Phone IP address|Dirección IP del teléfono| +Computer IP address|Dirección IP del ordenador| +Server IP Address|Dirección IP del Servidor| +Server IP|IP Del Servidor| +Login: |Login: | +Password: |Contraseña: | +Status: |Estado: | +Active Account|Cuenta Activa| +Phone Type|Tipo Del Teléfono| +Full Name|Nombre Completo| +Company: |Compañía: | +Picture: |Foto: | +Client Protocol|Protocolo Del Cliente| +Local GMT|GMT Local| +Do NOT Adjust for DST|No ajustar para el DST| +VALUE=SUBMIT|VALUE=ENVIAR| +ADD A NEW SERVER|AGREGAR Un SERVIDOR NUEVO| +Server ID|ID Del Servidor| +Server Description|Descripción Del Servidor| +Active: |Activo: | +Asterisk Version|Versión De Asterisk| +Conference Number|Número de la Conferencia| +New Messages|Mensajes Nuevos| +Old Messages|Mensajes Viejos| +Manager Login|Login del Manager| +Manager Secret|Contraseña del Manager| +VICIDIAL Default User|Usuario por defecto de VICIDIAL| +VICIDIAL Default Pass|Contraseña por defecto de VICIDIAL| +VICIDIAL Default Campaign|Campaña por defecto de VICIDIAL| +Park Extension|Extensión del parking| +Park Exten|Extensión del parking| +Conf Extension|Extensión de la conferencia| +Conf Exten|Extensión de la conferencia| +VICIDIAL Park Exten|Exten. Del parking de VICIDIAL| +VICIDIAL Park File|Archivo para música del parking de VICIDIAL| +Monitor Prefix|Prefijo al monitorizar| +Recording Exten|Exten de Grabación| +VMailMain Exten|Exten de VmailMain| +VMailDump Exten|Exten de VmaiDumpl| +Exten Context|Contexto De Exten| +DTMFSend Channel|Canal de envío del DTMF| +Outbound Call Group|Grupo de las llamadas de salida| +Browser Location|Localización del Navegador| +Install Directory|Directorio de instalación| +CallerID URL|URL del CallerID| +VICIDIAL Default URL|URL por defecto de VICIDIAL| +Call Logging|Call Logging| +User Switching|Cambio de Usuario| +Conferencing|Conferencias| +Admin Hangup|Colgar del Admin| +Admin Hijack|Captura del Admin| +Admin Monitor|Monitorización del Admin| +Call Park|Parking de Llamada| +Updater Check|Uptader Check| +AF Logging|AF Logging| +Queue Enabled|Colas permitidas| +CallerID Popup|Ventana emergente del CallerID| +VMail Button|Botón Vmail| +Fast Refresh|Refresco rápido| +Fast Refresh Rate|Refresco rápido de la tarifa| +Persistant MySQL|Persistant MySQL| +Auto Dial Next Number|Auto Marcar el Siguiente Número| +Stop Rec after each call|Parar de Grabar después de cada llamada| +Primary |Primario | +Secondary |Secundario | +DBX Server|Servidor de DBX| +DBX Database|Base de datos de DBX| +DBX User|Usuario de DBX| +DBX Pass|Contraseña de DBX| +DBX Port|Puerto de DBX| +DBY Server|Servidor de DBY| +DBY Database|Base de datos de DBY| +DBY User|Usuario de DBY| +DBY Pass|Contraseña de DBY| +DBY Port|Puerto de DBY| +MODIFY A SERVER RECORD|MODIFICAR UN REGISTRO DEL SERVIDOR| +Max VICIDIAL Trunks|Máx. Trunks en VICIDIAL| +Telnet Host|Host Del Telnet| +Telnet Port|Puerto Del Telnet| +Manager User|Usuario Del Manager| +Manager Update User|Usuario del Updater del Manager| +Manager Listen User|Usuario Listen del Manager| +Manager Send User|Usuario Send del Manager| +VMail Dump Exten|Extensión de Vmail Dump | +VICIDIAL AD extension|Extensión del AD de VICIDIAL| +Default Context|Contexto por Defecto| +PHONES WITHIN THIS SERVER|TELÉFONOS DENTRO DE ESTE SERVIDOR| +>EXTENSION<|>EXTENSIÓN<| +>NAME<|>NOMBRE<| +>ACTIVE<|>ACTIVO<| +>MODIFY<|>MODIFICAR<| +This server has|Este servidor tiene| +active phones and|Teléfonos activos y| +inactive phones|Teléfonos inactivos| +MODIFY A CONFERENCE RECORD|MODIFICAR UN REGISTRO DE LA CONFERENCIA| +Conference: |Conferencia: | +Current Extension|Extensión Actual| +extension: |Extensión: | +SEARCH RESULTS|RESULTADOS DE LA BÚSQUEDA| +PHONE LISTINGS|LISTADOS DE TELÉFONOS| +SERVER LISTINGS|LISTADOS DEL SERVIDOR| +CONFERENCE LISTINGS|LISTADOS DE CONFERENCIAS| +script runtime|Script runtime| +ADD NEW PHONE|NUEVO TELÉFONO| +ADD NEW SERVER|NUEVO SERVIDOR| +ADD NEW CONFERENCE|NUEVA CONFERENCIA| +ADDING NEW PHONE|CREANDO TELÉFONO| +ADDING NEW SERVER|CREANDO SERVIDOR| +ADDING NEW CONFERENCE|CREANDO CONFERENCIA| +MODIFY PHONE|MODIFICAR EL TELÉFONO| +MODIFY SERVER|MODIFICAR EL SERVIDOR| +MODIFY CONFERENCE|MODIFICAR LA CONFERENCIA| +MODIFYING PHONE|MODIFICANDO EL TELÉFONO| +MODIFYING SERVER|MODIFICANDO EL SERVIDOR| +MODIFYING CONFERENCE|MODIFICANDO LA CONFERENCIA| +SEARCH PHONES|BUSCAR TELÉFONOS| +SEARCH PHONES RESULTS|RESULTADO DE LA BÚSQUEDA DE TELÉFONOS| +PHONE LIST|LISTA DE TELÉFONOS| +SERVER LIST|LISTA DE SERVIDORES| +CONFERENCE LIST|LISTA DE CONFERENCIAS| +HELP|AYUDA| +Click here for phone stats|Pinchar aquí­ para ver las estadísticas del teléfono| +REMOTE INBOUND: Main|ENTRANTES REMOTOS: Principal| +REMOTE INBOUND: Popup|SALIENTES REMOTOS: Popup| +CALLS SENT TO|LLAMADAS REALIZADAS A| +Phone Stats|Estadísticas Del Teléfono| +CALL TIME AND CHANNELS|TIEMPO DE LLAMADA Y CANALES| +CHANNEL GROUP|GRUPO DE CANALES| +HOURS:MINUTES|HORAS:MINUTOS| +TOTAL CALLS|LLAMADAS TOTALES| +>NUMBER|>NÚMERO| + DATE<| FECHA<| +Close this window|Cierre esta ventana| +Inbound Calls Stats|Estadística de Llamadas Entrantes| +Add New User|Añadir un Usuario| +Add New Campaign|Añadir una Campaña| +Add New List|Añadir una Lista| +Add New In-Group|Añadir un Grupo-Entrantes| +Add New Remote Agents|Añadir Agentes Remotos| +Add New Users Group|Añadir un Grupo De Usuarios| +New User Addition|Nueva Adición De Usuario| +New Campaign Addition|Nueva Adición De la Campaña| +New Campaign Status Addition|Nueva Adición Del Estado De la Campaña| +New Campaign HotKey Addition|Nueva Adición De Tecla De Acceso Directo De la Campaña| +New List Addition|Nueva Adición De la Lista| +New In-Group Addition|Nueva Adición Del Grupo de Entrantes| +New Remote Agents Addition|Nueva Adición de Agentes Remotos| +New Users Group Addition|Nueva Adición Del Grupo De Usuarios| +Modify User|Modificar Usuario| +Modify Campaign - Basic View|Modificar Campaña - Vista Básica| +Modify Campaign|Modifcar Campaña| +Modify List|Modificar Lista| +Modify In-Group|Modificar In-Group| +Modify Remote Agents|Modificar Agentes Remotos| +Modify Users Groups|Modificar Grupos De Usuarios| +Welcome|Bienvenido| +Campaigns|Campañas| +Lists|Listas| +In-Groups|In-Groups| +Remote Agents|Agentes Remotos| +User Groups|Grupos De Usuario| +Search Form|Formulario De Búsqueda| +Search Results|RESULTADOS DE LA BÚSQUEDA| +VICIDIAL ADMIN|VICIDIAL ADMIN| + TABLE| TABLA| +First Name|Nombre| +Middle Initial|Inicial Media| +Last Name|Apellidos| +Address Line 1|Dirección, línea 1| +Address Line 2|Dirección, línea 2| +Address Line 3|Dirección, línea 3| +City|Ciudad| +State - limited to 2 characters|Estado - limitado a 2 caracteres| +Province|Provincia| +Postal Code|Código Postal| +Country|País| +Gender|Sexo| +Date of Birth|Fecha de nacimiento| +Alternate Phone Number|Número De Teléfono Alternativo| +Email Address|Dirección Email| +Security Phrase|Frase De Seguridad| +Comments|Comentarios| +THE END|EL FIN| +Logout|Salir| +LIST USERS|MOSTRAR USUARIOS| +ADD A NEW USER|NUEVO USUARIO | +SEARCH FOR A USER|BUSCAR UN USUARIO| +ADD USER GROUP|NUEVO GRUPO DE USUARIO| +LIST USER GROUPS|MOSTRAR GRUPOS DE USUARIO| +ADD CAMPAIGN|NUEVA CAMPAÑA | +LIST CAMPAIGNS|MOSTRAR CAMPAÑAS| +SHOW LISTS|MOSTRAR LISTAS| +ADD NEW LIST|NUEVA LISTA | +LOAD NEW LEADS|CARGAR LEADS| +SHOW IN-GROUPS|MOSTRAR IN-GROUPS| +ADD NEW IN-GROUP|NUEVO IN-GROUP| +SHOW REMOTE AGENTS|MOSTRAR LOS AGENTES REMOTOS| +ADD NEW REMOTE AGENTS|NUEVO AGENTE REMOTO| +SERVER STATS|ESTADÃSTICAS DEL SERVIDOR| +PARK REPORT|INFORME DE PARKING| +VDAD REPORT|INFORME DE VDAD| +CLOSER REPORT|INFORME CLOSER| +SEARCH FOR A LEAD|BÚSCAR UN LEAD| +GROUP HOURLY|GRUPO POR HORA| +User Number|NÚmero De Usuario| +Full Name|Nombre Completo| +User Level|Nivel Del Usuario| +User Group|Grupo Del Usuario| +ADD A NEW CAMPAIGN|NUEVA CAMPAÑA| +ADD A NEW INBOUND GROUP|NUEVO GRUPO DE ENTRADA| +ADD NEW USERS GROUP|NUEVO GRUPO DE USUARIOS| +Campaign ID|ID De la Campaña| +Campaign Name|Nombre de la Campaña| +Park Extension|Extensión Del Parking| +Park Filename|Nombre de fichero Del Parking| +Web Form|Formulario Web| +Allow Closers|Permitir Closers| +Hopper Level|Nivel Del Hopper| +Auto Dial Level|Nivel del Auto-Dial| +Next Agent Call|Llamar al Siguiente Agente| +Local Call Time|Franja horaria de llamada| +Voicemail|Buzón de Voz| +SUBMIT|ENVIAR| +List ID|ID De la Lista| +List Name|Nombre De la Lista| +Campaign: |Campaña: | +Group ID|ID De Grupo| +Group Name|Nombre De Grupo| +Group Color|Color Del Grupo| +Fronter Display|Mostrar Fronter| +User ID Start|Comienzo Del ID del usuario| +Number of Lines|Número de líneas| +External Extension|Extensión Externa| +Inbound Groups|Grupos De entrada| +Group: |Grupo: | +Description: |Descripción: | +USER ADDED|EL USUARIOAÑADIDO| +CAMPAIGN ADDED|CAMPAÑA AÑADIDA| +CAMPAIGN STATUS ADDED|ESTADO DE LA CAMPAÑA AÑADIDA| +CAMPAIGN HOTKEY ADDED|ACCESO DIRECTO A LA CAMPAÑA AÑADIDO| +LIST ADDED|LISTA AÑADIDA| +GROUP ADDED|GRUPO AÑADIDO| +REMOTE AGENTS ADDED|AGENTES REMOTO AÑADIDO| +USER GROUP ADDED|GRUPO DE USUARIO AÑADIDO| +USER MODIFIED|USUARIO MODIFICADO| +CAMPAIGN MODIFIED|CAMPAÑA MODIFICADA| +GROUP MODIFIED|GRUPO MODIFICADO| +CAMPAIGN MODIFIED|CAMPAÑA MODIFICADA| +LIST MODIFIED|LISTA MODIFICADA| +USER GROUP MODIFIED|GRUPO DE USUARIO MODIFICADO| +RESETTING LIST-CALLED-STATUS|REAJUSTANDO LA LISTA - LLAMADA - ESTADO| +Dial status |Estado del dial | +List Order|Orden De la Lista| +Hopper Level|Nivel Del Hopper| +Force Reset of Hopper|Forzar el Reinicio del Hopper| +Dial Timeout|Tiempo de espera Del Dial| +Dial Prefix|Prefijo al marcar| +Campaign CallerID|CallerID de la Campaña| +Campaign VDAD exten|Exten VDAD de La campaña| +LISTS WITHIN THIS CAMPAIGN|LISTAS DENTRO DE ESTA CAMPAÑA| +LIST ID|ID DE LA LISTA| +LIST NAME|NOMBRE DE LA LISTA| +>ACTIVE<|>ACTIVO<| +This campaign has |Esta campaña tiene | +active lists and |listas activas y | +inactive lists|listas inactivas| +leads to be dialed in those lists|Leads para ser llamados en estas listas| +leads in the dial hopper|Leads en el Hopper| +>STATUS<|>ESTADO<| +>DESCRIPTION<|>DESCRIPCIÓN<| +>SELECTABLE<|>SELECCIONABLE<| +>DELETE<|>ELIMINAR<| +ADD NEW CUSTOM CAMPAIGN STATUS|AGREGAR ESTADO PERSONALIZADO A LA CAMPAÑA| +Selectable: |Seleccionable: | +value=ADD|value=ADD| +CUSTOM HOTKEYS WITHIN THIS CAMPAIGN|PERSONALIZAR ACCEDOS DIRECTOS PARA ESTA CAMPAÑA| +>HOTKEY<|>ACCESO DIRECTO<| +ADD NEW CUSTOM CAMPAIGN HOTKEY|AÑADIR ACCESO DIRECTO A LA CAMPAÑA| +Hotkey: |Acceso Directo:| +Basic View|Vista Básica| +Detail View|Vista Detallada| +MODIFY A LISTS RECORD|MODIFICAR UN REGISTRO DE LAS LISTAS| +Reset Lead-Called-Status for this list|Reiniciar el Lead-Called-Status para esta lista| +STATUSES WITHIN THIS LIST|ESTADOS DENTRO DE ESTA LISTA| +>CALLED<|>LLAMADO<| +>NOT CALLED<|>NO LLAMADO<| +>SUBTOTALS<|>SUBTOTALES<| +>SUBTOTAL<|>SUBTOTAL<| +TIME ZONES WITHIN THIS LIST|ZONAS DE TIEMPO DENTRO DE ESTA LISTA| +GMT OFFSET NOW|DESPLAZAMIENTO GMT AHORA| +local time|tiempo local| +>TOTAL<|>TOTAL<| +CALLED COUNTS WITHIN THIS LIST|LLAMADAS REALIZADAS DENTRO DE ESTA LISTA| +MODIFY A GROUPS RECORD|MODIFICAR UN REGISTRO DE LOS GRUPOS| +MODIFY A REMOTE AGENTS ENTRY|MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS| +numbers only|Solamente números| +dialplan number dialed to reach agents|número del dialplan para alcanzar agentes| +MODIFY A USERS GROUP ENTRY|MODIFICAR UNA ENTRADA EN LOS GRUPOS DE USUARIOS| +no spaces or punctuation|sin espacios o signos de puntuación| +description of group|Descripción del grupo| +SEARCH FOR A USER|BUSCAR UN USUARIO| +SEARCH RESULTS|RESULTADOS DE LA BÚSQUEDA| +>STATS<|>ESTADÃSTICAS<| +USER LISTINGS|USUARIOS| +CAMPAIGN LISTINGS|CAMPAÑAS| +LIST LISTINGS|LISTAS| +INBOUND GROUP LISTINGS|GRUPOS DE ENTRADA | +REMOTE AGENTS LISTINGS|AGENTES REMOTOS| +USER GROUPS LISTINGS|GRUPOS DE USUARIO | +script runtime|Script runtime| +Hopper List|Lista De Hopper| +Live Current Hopper List|Live Current Hopper List| +Total leads in hopper right now|Total de Leads en el hopper ahora mismo| +Server Stats|ESTADÃSTICAS DEL SERVIDOR| +Total Calls placed from this Campaign: |Llamadas dentro de esta campaña| +Average Call Length for all Calls in seconds:|Longitud media para las llamadas en segundos:| +Total DROP Calls: |Total DROP Calls:| +Average Length for DROP Calls in seconds: |Longitud media para las llamadas DROP en segundos: | +Total NA calls -Busy,Disconnect,BTvoicemail: |Llamadas sin Respuesta - ocupado, desconexión,..: | +Average Call Length for NA Calls in seconds: |Longitud media para las Llamadas sin Respuesta en segundos: | +---------- DROPS|---------- DROPS| + AUTO-DIAL NO ANSWERS| AUTO-DIAL SIN RESPUESTA| +---------- USER STATS|---------- ESTADÃSTICAS DEL USUARIO| +---------- TIME STATS|---------- ESTADÃSTICAS DEL TIEMPO| +USER |USUARIO | +Agents Time On Calls |Tiempo de los Agentes En Llamadas| +agents logged in on server|agentes identificados en el servidor| +Paused agents|Agentes detenidos brevemente| +5 minutes or more on call|Llamadas de 5 minutos o más| +Over 10 minutes on call|Sobre 10 minutos en llamada| + NO AGENTS ON CALLS |AGENTES SIN LLAMADAS| +calls being placed on server|llamadas en el servidor| +LIVE CALL WAITING|LLAMADAS ACTUALES EN ESPERA| + NO LIVE CALLS WAITING |LLAMADAS EN ESPERA| +START OVER|RECARGAR| +Lead Loader Module|Módulo Cargador de Leads| +Current file status|Estado actual del archivo| +Load leads from this file|Cargar Leads de este archivo| +Processing |Procesando| +TALK TIME AND STATUS|TIEMPO Y ESTADO DE CONVERSACIÓN| +>COUNT<|>CUENTA<| +>HOURS:MINUTES<|>HORAS:MINUTOS<| +TOTAL CALLS |LLAMADAS TOTALES | +LOGIN/LOGOUT TIME|TIEMPO LOGIN/LOGOUT| +>EVENT <|>EVENTO<| +> CAMPAIGN<|> CAMPAÑA<| +LAST 50 CALLS|ÚLTIMAS 50 LLAMADAS| +VICIDIAL REMOTE: Call Disposition|REMOTE VICIDIAL: Disposición De la Llamada| +Call has been dispositioned|La llamada ha sido dispositioned| +Close This Window|Cierre Esta Ventana| +Call information|Información de la llamada| +lead lookup FAILED for lead_id|las operaciones de búsqueda del plomo FALLARON para el lead_id| +DISPO CALL|DISPO CALL| +>Address |>Dirección | +>City |>Ciudad | +>State:|>Estado:| + Postal Code:| Código Postal:| +>Province |>Provincia| +>Country |>País | +>Alt Phone |>Alt Phone | +>Email |>Email | +>Security |>Seguridad| +>Comments |>Comentarios | +>Disposition:|>Disposición:| +Group Hourly Stats|Stats Cada hora Del Grupo| +TSR HOUR COUNTS|CUENTAS DE HORAS DE TSR| +Lead Search|Buscar Lead| +Lead Lookup|Operaciones de búsqueda del Lead| +Please enter a:|Por favor, Introduzca un:| +a Home Phone Number:|un número de teléfono de casa:| +vendor lead code|código del vendedor del Lead| +a lead ID:|ID del Lead:| +>NEW SEARCH<|>NUEVA BÚSQUEDA<| +Lead record modification|Registro del Lead modificado| +information modified|Información modificada| +CALLS TO THIS LEAD|LLAMADAS A ESTE LEAD| +VDAD Closer Stats|Estadísticas de VDAD Closer| +Auto-dial Closer Stats|Estadísticas de Auto-dial en CLOSER| +VICIDIAL REMOTE AGENTS|VICIDIAL, AGENTES REMOTOS| +INBOUND STATS|ESTADÃSTICAS DE ENTRADA| +REMOTE AGENTS ERROR - Please go back and look at the data you entered|ERROR AGENTES REMOTOS – Por favor, vuelva atrás y compruebe los datos que introdujo| + - WAITING - |- ESPERANDO -| +Remote Agent inbound stats |Stats de entrada del agente alejado| +Total calls taken |Llamadas totales tomadas | +Total talk time on |Tiempo total de conversación| +Call list for |Lista la llamada para | + NO CALLS ON THIS DAY |NINGUNA LLAMADA PARA HOY| diff --git a/LANG_admin/LANG_admin/vicidial/AST_CLOSERstats.php b/LANG_admin/LANG_admin/vicidial/AST_CLOSERstats.php new file mode 100644 index 0000000..14c3e33 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_CLOSERstats.php @@ -0,0 +1,370 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_VDADstats.php b/LANG_admin/LANG_admin/vicidial/AST_VDADstats.php new file mode 100644 index 0000000..41580e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_VDADstats.php @@ -0,0 +1,390 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='NA' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+$NApercent = (($NAcalls / $TOTALcalls) * 100);
+$NApercent = round($NApercent, 0);
+
+$average_na_seconds = ($row[1] / $row[0]);
+$average_na_seconds = round($average_na_seconds, 0);
+$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+
+echo "Total NA calls -Busy,Disconnect,BTvoicemail:  $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_VICIDIAL_hopperlist.php b/LANG_admin/LANG_admin/vicidial/AST_VICIDIAL_hopperlist.php new file mode 100644 index 0000000..be9aa76 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,135 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} +if (!$server_ip) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+echo "|      | LEAD_ID   | PHONE NUM  | STATE | STATUS | COUNT | GMT    |\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now from vicidial_hopper,vicidial_list where vicidial_hopper.CAMPAIGN_ID='$group' and vicidial_hopper.lead_id=vicidial_list.lead_id order by hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+
+	echo "| $FMT_i | $lead_id | $phone_number | $state | $status | $count | $gmt |\n";
+
+	$i++;
+	}
+
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_admin_log_display.php b/LANG_admin/LANG_admin/vicidial/AST_admin_log_display.php new file mode 100644 index 0000000..490e895 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_admin_log_display.php @@ -0,0 +1,105 @@ + 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) + {$GREP_DATE = date("D, j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_agent_performance.php b/LANG_admin/LANG_admin/vicidial/AST_agent_performance.php new file mode 100644 index 0000000..7305f3c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_agent_performance.php @@ -0,0 +1,205 @@ + + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='$group' group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial/AST_agent_performance_detail.php b/LANG_admin/LANG_admin/vicidial/AST_agent_performance_detail.php
new file mode 100644
index 0000000..8c7ec4c
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial/AST_agent_performance_detail.php
@@ -0,0 +1,379 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$query_date=$_GET["query_date"];	if (!$query_date) {$query_date=$_POST["query_date"];}
+$group=$_GET["group"];				if (!$group) {$group=$_POST["group"];}
+$shift=$_GET["shift"];				if (!$shift) {$shift=$_POST["shift"];}
+$submit=$_GET["submit"];			if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];			if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 03:45:00";   
+	$query_date_END = "$query_date 15:15:00";
+	$time_BEGIN = "03:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:15:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TIME   | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG| A    | B    | DC   | DNC  | N    | NI   | CB   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='$group' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtime=($TOTtime + $row[1] + $row[5] + $row[7] + $row[9]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$TOTtotWAIT=($TOTtotWAIT + $row[7]);
+	$TOTtotPAUSE=($TOTtotPAUSE + $row[5]);
+	$TOTtotDISPO=($TOTtotDISPO + $row[9]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtime =	($row[1] + $row[5] + $row[7] + $row[9]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+	$USERtotPAUSE =	$row[5];
+	$USERavgPAUSE =	$row[6];
+	$USERtotWAIT =	$row[7];
+	$USERavgWAIT =	$row[8];
+	$USERtotDISPO =	$row[9];
+	$USERavgDISPO =	$row[10];
+
+	$USERtime_M = ($USERtime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS[$i] =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($USERtotPAUSE / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS[$i] =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($USERavgPAUSE / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS[$i] =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($USERtotWAIT / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS[$i] =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($USERavgWAIT / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS[$i] =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($USERtotDISPO / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS[$i] =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($USERavgDISPO / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS[$i] =		sprintf("%6s", $USERavgDISPO_MS);
+
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; $ctCB[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if (($row[1] == 'CALLBK') || ($row[1] == 'CBHOLD') ) {$ctCB[$k]=sprintf("%-4s", $row[0]);	$TOT_CB = ($TOT_CB + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtime_MS[$k]| $pfUSERtotPAUSE_MS[$k] | $pfUSERavgPAUSE_MS[$k] | $pfUSERtotWAIT_MS[$k] | $pfUSERavgWAIT_MS[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $pfUSERtotDISPO_MS[$k] | $pfUSERavgDISPO_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctCB[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = round($TOTtime_M, 2);
+	$TOTtime_M_int = intval("$TOTtime_M");
+	$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
+	$TOTtime_S = ($TOTtime_S * 60);
+	$TOTtime_S = round($TOTtime_S, 0);
+	if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%7s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>7) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%7s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>7) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%7s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>7) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%7s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>7) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+	
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_CB = sprintf("%-5s", $TOT_CB);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtime_MS| $TOTtotPAUSE_MS| $TOTavgPAUSE_MS | $TOTtotWAIT_MS| $TOTavgWAIT_MS | $TOTtotTALK_MS| $TOTavgTALK_MS | $TOTtotDISPO_MS| $TOTavgDISPO_MS | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_CB| $TOT_SALE|\n";
+echo "+--------------------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial/AST_agent_time_sheet.php b/LANG_admin/LANG_admin/vicidial/AST_agent_time_sheet.php
new file mode 100644
index 0000000..16f2f7e
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial/AST_agent_time_sheet.php
@@ -0,0 +1,256 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$agent=$_GET["agent"];						if (!$agent) {$agent=$_POST["agent"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$calls_summary=$_GET["calls_summary"];		if (!$calls_summary) {$calls_summary=$_POST["calls_summary"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];					if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial/AST_parkstats.php b/LANG_admin/LANG_admin/vicidial/AST_parkstats.php
new file mode 100644
index 0000000..86a0d7c
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial/AST_parkstats.php
@@ -0,0 +1,369 @@
+
+
+
+
+
+
+\n";
+#echo"\n";
+echo "VICIDIAL: Park Stats\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A GROUP AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Park Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls taken in this Group:              $TOTALcalls\n";
+echo "Average Hold Time(seconds) for all Calls:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Dropped Calls:                          $DROPcalls  $DROPpercent%\n";
+echo "Average Hold Time(seconds) for Dropped Calls: $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select park_log.user,full_name,count(*),sum(talked_sec),avg(talked_sec) from park_log,vicidial_users where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group' and park_log.user is not null and talked_sec is not null and talked_sec > 4 and park_log.user=vicidial_users.user group by park_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_server_performance.php b/LANG_admin/LANG_admin/vicidial/AST_server_performance.php new file mode 100644 index 0000000..36d1b00 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_server_performance.php @@ -0,0 +1,283 @@ + + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:32:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:32:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$HIGHload =	sprintf("%10s", $row[0]);
+$HIGHmulti = intval($HIGHload / 100);
+#$HIGHmulti = ($HIGHload / 100);
+
+$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$USEDram =	sprintf("%10s", $row[0]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365') and  start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average channels in use for server:       $AVGchannels\n";
+echo "Average load for server:                  $AVGload\n";
+echo "Peak load for server:                     $HIGHload\n";
+#echo "Peak used memory for server (in MB):      $USEDram\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHload\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc 30 minutes\n";
+$HTMcontent .= "minorticinc: 5 minutes\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD.php b/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD.php new file mode 100644 index 0000000..d55705f --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD.php @@ -0,0 +1,231 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	$agentcount=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED",$row[4]))
+			{
+			$row[3]='';
+			$row[5]=' - WAITING - ';
+			$row[6]=$row[7];
+			}
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$sessionid =		sprintf("%-9s", $row[2]);
+		$channel =			sprintf("%-10s", $row[3]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[4]);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 5) {$G=''; $EG='';}
+		if ($call_time_M_int >= 10) {$G=''; $EG='';}
+		if (eregi("PAUSED",$row[4])) 
+			{
+			if ($call_time_M_int >= 1) 
+				{$i++; continue;} 
+			else
+				{$G=''; $EG='';}
+			}
+
+		$agentcount++;
+		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-8s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD_closer.php b/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD_closer.php new file mode 100644 index 0000000..cefa232 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_timeonVDAD_closer.php @@ -0,0 +1,289 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] =		sprintf("%-10s", $row[0]);
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where uniqueid='$uniqueid[$i]' and server_ip='$server_ip';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_timeonVDADall.php b/LANG_admin/LANG_admin/vicidial/AST_timeonVDADall.php new file mode 100644 index 0000000..8edd342 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_timeonVDADall.php @@ -0,0 +1,272 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# changes: +# 50406-0920 Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 Modified layout and info to show all servers in a vicidial system + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$RR=$_GET["RR"]; if (!$RR) {$RR=$_POST["RR"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!$RR) {$RR=40;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL: Realtime Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "                   \n"; +echo "STOP | GO \n"; +echo "\n\n"; + +if (!$group) {echo "

please select a campaign from the pulldown above\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order from vicidial_campaigns where campaign_id='$group';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); + +echo "
"; +echo "DIAL LEVEL: $row[0]         "; +echo "STATUSES: $row[1], $row[2], $row[3], $row[4], $row[5]         "; +echo "ORDER: $row[6]"; +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if (eregi("CLOSER",$group)) + {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and (campaign_id='$group' or campaign_id LIKE \"CL_%\");";} +else + {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and campaign_id='$group';";} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if (eregi("CLOSER",$group)) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; +$Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; +$Aecho .= "| STATION | USER | SESSIONID | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; +$Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='$group' order by status,last_call_time;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[5]=$row[6]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $sessionid = sprintf("%-9s", $row[2]); + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $call_time_S = ($STARTtime - $row[5]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} +# if ($call_time_M_int >= 10) {$G=''; $EG='';} + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 1) + {$i++; continue;} + else + {$G=''; $EG=''; $agent_paused++; $agent_total++;} + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$G=''; $EG='';} + + $agentcount++; + $Aecho .= "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$status$EG | $G$server_ip$EG | $G$call_server_ip$EG | $G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= " $agentcount agents logged in on all servers\n\n"; + + $Aecho .= " - Paused agents\n"; + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Over 5 minutes on call\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial/AST_timeoncall.php b/LANG_admin/LANG_admin/vicidial/AST_timeoncall.php new file mode 100644 index 0000000..f56740e --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_timeoncall.php @@ -0,0 +1,171 @@ + + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 60);
+			$call_time_M = round($call_time_M, 2);
+			$call_time_M_int = intval("$call_time_M");
+			$call_time_SEC = ($call_time_M - $call_time_M_int);
+			$call_time_SEC = ($call_time_SEC * 60);
+			$call_time_SEC = round($call_time_SEC, 0);
+			if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+			$call_time_MS = "$call_time_M_int:$call_time_SEC";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/AST_timeonpark.php b/LANG_admin/LANG_admin/vicidial/AST_timeonpark.php new file mode 100644 index 0000000..2037c6d --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/AST_timeonpark.php @@ -0,0 +1,193 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park                       $NOW_TIME\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='$server_ip' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "******************** NO LIVE CALLS WAITING *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='$server_ip' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/admin-old.php b/LANG_admin/LANG_admin/vicidial/admin-old.php new file mode 100644 index 0000000..2adf48f --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/admin-old.php @@ -0,0 +1,2289 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if ($ADD==1) {echo "Add New User";} +if ($ADD==11) {echo "Add New Campaign";} +if ($ADD==111) {echo "Add New List";} +if ($ADD==1111) {echo "Add New In-Group";} +if ($ADD==11111) {echo "Add New Remote Agents";} +if ($ADD==111111) {echo "Add New Users Group";} +if ($ADD==2) {echo "New User Addition";} +if ($ADD==21) {echo "New Campaign Addition";} +if ($ADD==22) {echo "New Campaign Status Addition";} +if ($ADD==211) {echo "New List Addition";} +if ($ADD==2111) {echo "New In-Group Addition";} +if ($ADD==21111) {echo "New Remote Agents Addition";} +if ($ADD==211111) {echo "New Users Group Addition";} +if ($ADD==3) {echo "Modify User";} +if ($ADD==31) {echo "Modify Campaign";} +if ($ADD==311) {echo "Modify List";} +if ($ADD==3111) {echo "Modify In-Group";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==311111) {echo "Modify Users Groups";} +if ($ADD==4) {echo "Modify User";} +if ($ADD==41) {echo "Modify Campaign";} +if ($ADD==42) {echo "Modify Campaign Status";} +if ($ADD==411) {echo "Modify List";} +if ($ADD==4111) {echo "Modify In-Group";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==411111) {echo "Modify Users Group";} +if ($ADD==0) {echo "Welcome";} +if ($ADD==10) {echo "Campaigns";} +if ($ADD==100) {echo "Lists";} +if ($ADD==1000) {echo "In-Groups";} +if ($ADD==10000) {echo "Remote Agents";} +if ($ADD==100000) {echo "User Groups";} +if ($ADD==5) {echo "Search Form";} +if ($ADD==6) {echo "Search Results";} +if ($ADD==99999) {echo "HELP";} + +if ( (strlen($ADD)>4) && ($ADD < 99998) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<50) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
$lang_list_name $lang_list_name
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL user's ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL user's password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL user's full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL user's user level. Must be a level of 1 to log into VICIDIAL, 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. + +
+
+
+User Group - This menu is where you select the VICIDIAL user's group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below + +
+
+
+List Order - This menu is where you select how the leads(that match the statuses selected above) will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works it's way down +
  - DOWN PHONE: select the lowest phone number and works it's way up +
  - UP LAST NAME: starts with last names starting with Z and works it's way down +
  - DOWN LAST NAME: starts with last names starting with A and works it's way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works it's way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works it's way up inserting a NEW lead in every other lead(Must NOT have NEW selected in the dial statuses) +
  - DOWN COUNT 3nd NEW: starts with least called leads and works it's way up inserting a NEW lead in every third lead(Must NOT have NEW selected in the dial statuses) +
  - DOWN COUNT 4th NEW: starts with least called leads and works it's way up inserting a NEW lead in every forth lead(Must NOT have NEW selected in the dial statuses) + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_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. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero (0) means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL 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. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Dial Timeout - If defined, calls that would normally hangup after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dialplan(extensions.conf). + +
+
+
+Campaign CallerID - 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. This option is only available if you are using PRIs(ISDN T1s or E1s) that have the custom callerid feature turned on. This feature may also work with IAX2 trunks depending on what your provider allows. The custom callerID only applies to calls placed for the VICIDIAL 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. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI(exten 8365 [agi-VDADtransfer.agi]) just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included (8366 [agi-VDADtransferSURVEY.agi]) that plays a message to the called person and allows them to make a choice by pressing buttons(effectively pre-screening the lead). Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes '-', plusses '+' or spaces ' '. + +
+
+
+Group Color - This is the color that displays in the VICIDIAL 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 VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Voicemail - If defined, this is the Voicemail box that calls will go to instead of being dropped if no agents are available after the hold time is up. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. + +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name(if there is one) displayed in the Status field when the call comes to the agent. + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - 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 VICIDIAL 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. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dialplan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+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 VICIDIAL as a disposition. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL 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 vicidial_list table. The lead loader does not do data validation or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number(1 for US, 01144 for UK, 01161 for AUS, etc) +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer(Mr. Ms. Mrs, etc...) +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ + + +







+







+THE END +
+ + + + + +
+ + + + + + + +
  VICIDIAL ADMIN - Logout  
  LIST USERS | ADD NEW USER | SEARCH FOR A USER | ADD USER GROUP | LIST USER GROUPS
  ADD CAMPAIGN | LIST CAMPAIGNS | SHOW LISTS | ADD NEW LIST |               | LOAD NEW LEADS
  SHOW IN-GROUPS | ADD NEW IN-GROUP | SHOW REMOTE AGENTS | ADD NEW REMOTE AGENTS
  SERVER STATS | PARK REPORT | VDAD REPORT | CLOSER REPORT |               | SEARCH FOR A LEAD | GROUP HOURLY
+"; + +echo "
ADD A NEW USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW CAMPAIGN\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
ADD A NEW INBOUND GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
ADD NEW REMOTE AGENTS\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
ADD NEW USERS GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=2 adds the new person to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\n"; + + $stmt="INSERT INTO vicidial_users values('','$user','$pass','$full_name','$user_level','$user_group');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level'|\n"); + fclose($fp); + } + } +$ADD=0; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns values('$campaign_id','$campaign_name','$active','','','','','','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','','','','');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|'$campaign_id','$campaign_name','$active','','','','','','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','','','',''|\n"); + fclose($fp); + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi('-',$group_id)) or (eregi('+',$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display'|\n"); + fclose($fp); + + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + + } + } +$ADD=100000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group' where user='$user'|\n"); + fclose($fp); + + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display' where group_id='$group_id'|\n"); + fclose($fp); + + } + +$ADD=3111; # go to group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + + } + +$ADD=311111; # go to user group modification form below +} + + + + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[5]; + +echo "
MODIFY A USER'S RECORD: $row[1]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
\n"; + +echo "

Click here for user stats\n"; + +} + + +###################### +# ADD=31 modify campaign info in the system +###################### + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
STATUSDESCRIPTIONSELECTABLEDELETE
$rowx[0]$rowx[1]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; +echo "\n"; +echo "\n"; +echo "Status:   \n"; +echo "Description:   \n"; +echo "Selectable:   \n"; +echo "
\n"; + +echo "

\n"; + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
MODIFY A LIST'S RECORD: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
STATUSES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
STATUSCALLEDNOT CALLED
$rowx[0] $rowx[2]
$rowx[0]$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
TIME ZONES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
STATUS$firstSUBTOTAL
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + +echo "
MODIFY A GROUP'S RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
MODIFY A USERS GROUP ENTRY\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + + + + + + + +###################### +# ADD=5 search form +###################### + +if ($ADD==5) +{ +echo ""; + +echo "
SEARCH FOR A USER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=6 user search results +###################### + +if ($ADD==6) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group LIKE \"%$user_group%\" and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS
\n"; + +} + + + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/admin.php b/LANG_admin/LANG_admin/vicidial/admin.php new file mode 100644 index 0000000..9afeb39 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/admin.php @@ -0,0 +1,4156 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$full_name=$_GET["full_name"]; if (!$full_name) {$full_name=$_POST["full_name"];} +$user_level=$_GET["user_level"]; if (!$user_level) {$user_level=$_POST["user_level"];} +$user_group=$_GET["user_group"]; if (!$user_group) {$user_group=$_POST["user_group"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$campaign_name=$_GET["campaign_name"]; if (!$campaign_name) {$campaign_name=$_POST["campaign_name"];} +$active=$_GET["active"]; if (!$active) {$active=$_POST["active"];} +$park_ext=$_GET["park_ext"]; if (!$park_ext) {$park_ext=$_POST["park_ext"];} +$park_file_name=$_GET["park_file_name"]; if (!$park_file_name) {$park_file_name=$_POST["park_file_name"];} +$web_form_address=$_GET["web_form_address"]; if (!$web_form_address) {$web_form_address=$_POST["web_form_address"];} +$allow_closers=$_GET["allow_closers"]; if (!$allow_closers) {$allow_closers=$_POST["allow_closers"];} +$hopper_level=$_GET["hopper_level"]; if (!$hopper_level) {$hopper_level=$_POST["hopper_level"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$next_agent_call=$_GET["next_agent_call"]; if (!$next_agent_call) {$next_agent_call=$_POST["next_agent_call"];} +$local_call_time=$_GET["local_call_time"]; if (!$local_call_time) {$local_call_time=$_POST["local_call_time"];} +$voicemail_ext=$_GET["voicemail_ext"]; if (!$voicemail_ext) {$voicemail_ext=$_POST["voicemail_ext"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$list_name=$_GET["list_name"]; if (!$list_name) {$list_name=$_POST["list_name"];} +$group_id=$_GET["group_id"]; if (!$group_id) {$group_id=$_POST["group_id"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$group_color=$_GET["group_color"]; if (!$group_color) {$group_color=$_POST["group_color"];} +$fronter_display=$_GET["fronter_display"]; if (!$fronter_display) {$fronter_display=$_POST["fronter_display"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$dial_status_a=$_GET["dial_status_a"]; if (!$dial_status_a) {$dial_status_a=$_POST["dial_status_a"];} +$dial_status_b=$_GET["dial_status_b"]; if (!$dial_status_b) {$dial_status_b=$_POST["dial_status_b"];} +$dial_status_c=$_GET["dial_status_c"]; if (!$dial_status_c) {$dial_status_c=$_POST["dial_status_c"];} +$dial_status_d=$_GET["dial_status_d"]; if (!$dial_status_d) {$dial_status_d=$_POST["dial_status_d"];} +$dial_status_e=$_GET["dial_status_e"]; if (!$dial_status_e) {$dial_status_e=$_POST["dial_status_e"];} +$lead_order=$_GET["lead_order"]; if (!$lead_order) {$lead_order=$_POST["lead_order"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$campaign_vdad_exten=$_GET["campaign_vdad_exten"]; if (!$campaign_vdad_exten) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +$campaign_rec_exten=$_GET["campaign_rec_exten"]; if (!$campaign_rec_exten) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +$campaign_recording=$_GET["campaign_recording"]; if (!$campaign_recording) {$campaign_recording=$_POST["campaign_recording"];} +$campaign_rec_filename=$_GET["campaign_rec_filename"]; if (!$campaign_rec_filename) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +$hotkey=$_GET["hotkey"]; if (!$hotkey) {$hotkey=$_POST["hotkey"];} +$reset_list=$_GET["reset_list"]; if (!$reset_list) {$reset_list=$_POST["reset_list"];} +$old_campaign_id=$_GET["old_campaign_id"]; if (!$old_campaign_id) {$old_campaign_id=$_POST["old_campaign_id"];} +$OLDuser_group=$_GET["OLDuser_group"]; if (!$OLDuser_group) {$OLDuser_group=$_POST["OLDuser_group"];} +$status_name=$_GET["status_name"]; if (!$status_name) {$status_name=$_POST["status_name"];} +$selectable=$_GET["selectable"]; if (!$selectable) {$selectable=$_POST["selectable"];} +$HKstatus=$_GET["HKstatus"]; if (!$HKstatus) {$HKstatus=$_POST["HKstatus"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} +$delete_users=$_GET["delete_users"]; if (!$delete_users) {$delete_users=$_POST["delete_users"];} +$delete_user_groups=$_GET["delete_user_groups"]; if (!$delete_user_groups) {$delete_user_groups=$_POST["delete_user_groups"];} +$delete_lists=$_GET["delete_lists"]; if (!$delete_lists) {$delete_lists=$_POST["delete_lists"];} +$delete_campaigns=$_GET["delete_campaigns"]; if (!$delete_campaigns) {$delete_campaigns=$_POST["delete_campaigns"];} +$delete_ingroups=$_GET["delete_ingroups"]; if (!$delete_ingroups) {$delete_ingroups=$_POST["delete_ingroups"];} +$delete_remote_agents=$_GET["delete_remote_agents"]; if (!$delete_remote_agents) {$delete_remote_agents=$_POST["delete_remote_agents"];} +$load_leads=$_GET["load_leads"]; if (!$load_leads) {$load_leads=$_POST["load_leads"];} +$campaign_detail=$_GET["campaign_detail"]; if (!$campaign_detail) {$campaign_detail=$_POST["campaign_detail"];} +$ast_admin_access=$_GET["ast_admin_access"]; if (!$ast_admin_access) {$ast_admin_access=$_POST["ast_admin_access"];} +$ast_delete_phones=$_GET["ast_delete_phones"]; if (!$ast_delete_phones) {$ast_delete_phones=$_POST["ast_delete_phones"];} +$CoNfIrM=$_GET["CoNfIrM"]; if (!$CoNfIrM) {$CoNfIrM=$_POST["CoNfIrM"];} +$delete_scripts=$_GET["delete_scripts"]; if (!$delete_scripts) {$delete_scripts=$_POST["delete_scripts"];} +$script_id=$_GET["script_id"]; if (!$script_id) {$script_id=$_POST["script_id"];} + $script_id = strtoupper($script_id); +$script_name=$_GET["script_name"]; if (!$script_name) {$script_name=$_POST["script_name"];} +$script_comments=$_GET["script_comments"]; if (!$script_comments) {$script_comments=$_POST["script_comments"];} +$script_text=$_GET["script_text"]; if (!$script_text) {$script_text=$_POST["script_text"];} +$reset_hopper=$_GET["reset_hopper"]; if (!$reset_hopper) {$reset_hopper=$_POST["reset_hopper"];} +$get_call_launch=$_GET["get_call_launch"]; if (!$get_call_launch) {$get_call_launch=$_POST["get_call_launch"];} +$am_message_exten=$_GET["am_message_exten"]; if (!$am_message_exten) {$am_message_exten=$_POST["am_message_exten"];} +$amd_send_to_vmx=$_GET["amd_send_to_vmx"]; if (!$amd_send_to_vmx) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"]; if (!$xferconf_a_dtmf) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +$xferconf_a_number=$_GET["xferconf_a_number"]; if (!$xferconf_a_number) {$xferconf_a_number=$_POST["xferconf_a_number"];} +$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"]; if (!$xferconf_b_dtmf) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +$xferconf_b_number=$_GET["xferconf_b_number"]; if (!$xferconf_b_number) {$xferconf_b_number=$_POST["xferconf_b_number"];} +$modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST["modify_leads"];} +$hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} +$change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} +$agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} + + + + +### AST GUI database administration +### admin.php +### +### CHANGES +### 50315-1110 - Added Custom Campaign Statuses +### 50317-1438 - Added Fronter Display var to inbound groups +### 50322-1355 - Added custom callerID per campaign +### 50517-1356 - Added user_groups sections and user_group to vicidial_users +### 50517-1440 - Added ability to logout (must click OK with empty user/pass) +### 50602-1622 - Added lead loader pages to load new files into vicidial_list +### 50620-1351 - Added custom vdad transfer AGI extension per campaign +### 50810-1414 - modified in groups to kick out spaces and dashes +### 50908-2136 - Added Custom Campaign HotKeys +### 50914-0950 - Fixed user search by user_group +### 50926-1358 - Modified to allow for language translation +### 50926-1615 - Added WeBRooTWritablE write controls +### 51020-1008 - Added editable web address and park ext - NEW dial campaigns +### 51020-1056 - Added fields and help for campaign recording control +### 51123-1335 - Altered code to function in php globals=off +### 51208-1038 - Added user_level changes, function controls and default user phones +### 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +### 51213-1706 - Added add/delete/modify vicidial scripts +### 51214-1737 - Added preview of vicidial script in popup window +### 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +### 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +### 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +### 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +### 60204-0659 - Fixed hopper reset bug +### 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +### 60213-1100 - Added several vicidial_users permissions fields +### 60215-1319 - Added On-hold CallBacks display and links +### 60227-1226 - Fixed vicidial_inbound_groups insert bug + +### 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 + +$version = '1.1.10-5'; +$build = '60227-1226'; + +$STARTtime = date("U"); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGdelete_scripts =$row[18]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if ($ADD==1) {echo "Add New User";} +if ($ADD==11) {echo "Add New Campaign";} +if ($ADD==111) {echo "Add New List";} +if ($ADD==1111) {echo "Add New In-Group";} +if ($ADD==11111) {echo "Add New Remote Agents";} +if ($ADD==111111) {echo "Add New Users Group";} +if ($ADD==1111111) {echo "Add New Script";} +if ($ADD==2) {echo "New User Addition";} +if ($ADD==21) {echo "New Campaign Addition";} +if ($ADD==22) {echo "New Campaign Status Addition";} +if ($ADD==23) {echo "New Campaign HotKey Addition";} +if ($ADD==211) {echo "New List Addition";} +if ($ADD==2111) {echo "New In-Group Addition";} +if ($ADD==21111) {echo "New Remote Agents Addition";} +if ($ADD==211111) {echo "New Users Group Addition";} +if ($ADD==2111111) {echo "New Script Addition";} +if ($ADD==3) {echo "Modify User";} +if ($ADD==31) {echo "Modify Campaign";} +if ($ADD==34) {echo "Modify Campaign - Basic View";} +if ($ADD==311) {echo "Modify List";} +if ($ADD==3111) {echo "Modify In-Group";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==311111) {echo "Modify Users Groups";} +if ($ADD==3111111) {echo "Modify Script";} +if ($ADD=="4A") {echo "Modify User - Admin";} +if ($ADD==4) {echo "Modify User";} +if ($ADD==41) {echo "Modify Campaign";} +if ($ADD==42) {echo "Modify Campaign Status";} +if ($ADD==43) {echo "Modify Campaign HotKey";} +if ($ADD==44) {echo "Modify Campaign - Basic View";} +if ($ADD==411) {echo "Modify List";} +if ($ADD==4111) {echo "Modify In-Group";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==411111) {echo "Modify Users Groups";} +if ($ADD==4111111) {echo "Modify Script";} +if ($ADD==5) {echo "Delete User";} +if ($ADD==51) {echo "Delete Campaign";} +if ($ADD==52) {echo "Logout Agents";} +if ($ADD==511) {echo "Delete List";} +if ($ADD==5111) {echo "Delete In-Group";} +if ($ADD==51111) {echo "Delete Remote Agents";} +if ($ADD==511111) {echo "Delete Users Group";} +if ($ADD==5111111) {echo "Delete Script";} +if ($ADD==6) {echo "Delete User";} +if ($ADD==61) {echo "Delete Campaign";} +if ($ADD==62) {echo "Logout Agents";} +if ($ADD==611) {echo "Delete List";} +if ($ADD==6111) {echo "Delete In-Group";} +if ($ADD==61111) {echo "Delete Remote Agents";} +if ($ADD==611111) {echo "Delete Users Group";} +if ($ADD==6111111) {echo "Delete Script";} +if ($ADD==7111111) {echo "Preview Script";} +if ($ADD==0) {echo "Welcome";} +if ($ADD==8) {echo "CallBacks Within Agent";} +if ($ADD==81) {echo "CallBacks Within Campaign";} +if ($ADD==811) {echo "CallBacks Within List";} +if ($ADD==10) {echo "Campaigns";} +if ($ADD==100) {echo "Lists";} +if ($ADD==1000) {echo "In-Groups";} +if ($ADD==10000) {echo "Remote Agents";} +if ($ADD==100000) {echo "User Groups";} +if ($ADD==1000000) {echo "Scripts";} +if ($ADD==55) {echo "Search Form";} +if ($ADD==66) {echo "Search Results";} +if ($ADD==99999) {echo "HELP";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rsltx=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rsltx); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or ($ADD=="4A") ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<100) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, 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. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+HotKeys Active - This option if set to 1 allows the user to use the HotKeys quick-dispositioning function in vicidial.php. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_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. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL 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. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Dial Timeout - If defined, calls that would normally hangup after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dialplan - extensions.conf. + +
+
+
+Campaign CallerID - 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. This option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on. This feature may also work with IAX2 trunks depending on what your provider allows. The custom callerID only applies to calls placed for the VICIDIAL 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. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. 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 upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. 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. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dialplan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL 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 VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Voicemail - If defined, this is the Voicemail box that calls will go to instead of being dropped if no agents are available after the hold time is up. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - 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 VICIDIAL 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. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dialplan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+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 VICIDIAL as a disposition. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hotkeys, agents that use the vicidial web-client can hangup and disposition calls just by pressing a single key on their keyboard. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial 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. + +
+
+Script Name - This is the title of a Vicidial 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. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today? + +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL 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 vicidial_list table. There is also a new beta version super lead loader that 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 or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /home/cron/AST_SERVER_conf.pl file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. + +







+







+THE END +
+\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + + +?> + + + + +\n"; +?> +
+ + + + + + + +
  VICIDIAL ADMIN - Logout  
  LIST USERS | ADD A NEW USER | SEARCH FOR A USER |               |ADD USER GROUP | LIST USER GROUPS
  ADD CAMPAIGN | LIST CAMPAIGNS |              | SHOW LISTS | ADD NEW LIST |               | LOAD NEW LEADS
  SHOW IN-GROUPS | ADD NEW IN-GROUP |               | SHOW REMOTE AGENTS | ADD NEW REMOTE AGENTS
  STATS AND REPORTS               | ADD SCRIPT | VIEW SCRIPTS |             | SEARCH FOR A LEAD | GROUP HOURLY
+"; + +echo "
ADD A NEW USER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "$NWB#vicidial_users-user_group$NWE\n"; +echo "\n"; +echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW CAMPAIGN\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
ADD A NEW INBOUND GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
ADD NEW REMOTE AGENTS\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
ADD NEW USERS GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ +echo ""; + +echo "
ADD NEW SCRIPT\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: $NWB#vicidial_scripts-script_text$NWE
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\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');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch')|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } + } +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOTKEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOTKEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOTKEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch'|\n"); + fclose($fp); + } + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|'$script_id','$script_name','$script_comments','$script_text','$active'|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|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' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOTKEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + } + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id'|\n"); + fclose($fp); + } + } + +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + } + } + +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id'|\n"); + fclose($fp); + } + } + +$ADD=3111111; # go to script modification form below +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to user group modification below +} + + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|user='$user'|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents fro a campaign +###################### + +if ($ADD==62) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='31'; # go to campaign modification below +} +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to user group list +} + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + +if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } +else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + {echo "\n";} + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level > 8) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
HotKeys Active: $NWB#vicidial_users-hotkeys_active$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_users-closer_campaigns$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + +echo "
MODIFY A CAMPAIGNS RECORD: $row[0] - Basic View | Detail View\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
STATUSDESCRIPTIONSELECTABLEDELETE
$rowx[0]$rowx[1]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; +echo "\n"; +echo "\n"; +echo "Status:   \n"; +echo "Description:   \n"; +echo "Selectable:   \n"; +echo "
\n"; + +echo "

\n"; + + + +echo "
CUSTOM HOTKEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
HOTKEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN HOTKEY
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Hotkey:   \n"; +echo "Status:   \n"; +echo "
\n"; + +echo "

\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ($ADD==34) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Basic View | Detail View
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + +echo "
\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
MODIFY A LISTS RECORD: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
STATUSES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[0] == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
STATUSCALLEDNOT CALLED
$CLB$rowx[0]$CLE $rowx[2]
$CLB$rowx[0]$CLE$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
TIME ZONES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
STATUS$firstSUBTOTAL
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + +echo "
MODIFY A GROUPS RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + + +echo "\n"; +echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +if ($LOGdelete_ingroups > 0) + { + echo "

DELETE THIS IN-GROUP\n"; + } + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + +if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
MODIFY A USERS GROUP ENTRY\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; +echo ""; + +echo "
MODIFY A SCRIPT\n"; +echo "\n"; +echo "\n"; +echo "Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Comments: $NWB#vicidial_scripts-script_comments$NWE\n"; +echo "Active: $NWB#vicidial_scripts-active$NWE\n"; +echo "Script Text:

Preview Script $NWB#vicidial_scripts-script_text$NWE\n"; +echo "\n"; +echo "
\n"; + +if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + +} + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
SEARCH FOR A USER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=66 user search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and user='$user' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and campaign_id='$campaign_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and list_id='$list_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ +echo "
\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTCAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENT
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]
\n"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/admin_modify_lead.php b/LANG_admin/LANG_admin/vicidial/admin_modify_lead.php new file mode 100644 index 0000000..9440ee5 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/admin_modify_lead.php @@ -0,0 +1,321 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead record modification + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where lead_id='$lead_id' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
\n"; + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/admin_search_lead.php b/LANG_admin/LANG_admin/vicidial/admin_search_lead.php new file mode 100644 index 0000000..e5d4af3 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/admin_search_lead.php @@ -0,0 +1,185 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration search for lead info +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + + +
\n"; + echo "
\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='$vendor_id'"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='$phone'"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if (eregi('10.10.10.2',$ip)) + { + echo "\n\n$stmt\n\n"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($row[0]) < 3) && (strlen($row[1]) < 3) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "\n
\n\n";
+		echo "lead ID: $row[0]\n";
+		echo "status: $row[3]\n";
+		echo "vendor_id: $row[5]\n";
+		echo "last rep called: $row[4]\n";
+		echo "list_id: $row[7]\n";
+		echo "phone: $row[11]\n";
+		echo "Name: $row[13] $row[15]\n";
+		echo "City: $row[19]\n";
+		echo "Security: $row[28]\n";
+		echo "Comments: $row[29]\n\n";
+		echo "\n";
+		echo "
\n"; + + # https://www.vicimarketing.com/internal/back_end_sys/uk_cust_serv/index.php?person_id=$row[7]&people_packages_id=&secure_lvl=2&display=2&username=$username&passwd=$passwd + + echo "Click here to see the Lead Details\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/closer-fronter_popup.php b/LANG_admin/LANG_admin/vicidial/closer-fronter_popup.php new file mode 100644 index 0000000..adfce3f --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/closer-fronter_popup.php @@ -0,0 +1,470 @@ + 0;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) + { + echo "\n\n"; + echo "\n\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; + $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $filename','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('Zap/$channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$user'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $user - $full_name\n

\n"; + + $url = "http://10.10.99.2/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + +# $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$user' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; +# if ($DB) {echo "|$stmt|\n";} +# $fp = fopen ("./closer_SQL_updates.txt", "a"); +# fwrite ($fp, "$date|$user|$stmt|\n"); +# fclose($fp); +# $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/closer-fronter_popup2.php b/LANG_admin/LANG_admin/vicidial/closer-fronter_popup2.php new file mode 100644 index 0000000..783ea1c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/closer-fronter_popup2.php @@ -0,0 +1,385 @@ + 0;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if (!$auth) + { + if ( (strlen($PHP_AUTH_USER)>1) and ( (eregi("tsr",$PHP_AUTH_PW)) or (eregi("sales",$PHP_AUTH_PW)) ) ) + { + $auth=1; + $user = $PHP_AUTH_USER; + $pass = $PHP_AUTH_PW; + } + } + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER - $user - $PHP_AUTH_USER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and ( (eregi('zap',$customer_zap_channel)) or (eregi('iax',$customer_zap_channel)) ) ) + { + echo "\n\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; +# $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $filename','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$fronter'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $fronter - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='$channel_group'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $group_name = $row[0]; + $group_color = $row[1]; + + echo "
\n"; + echo "
$channel_group - $group_name

\n\n"; + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### + +if (eregi('CL',$channel_group)) + { + if (strlen($phone) > 9) {$search_phone = $phone;} + if ( (strlen($search_phone) < 10) or (strlen($fronter) < 1) ) + { + echo "\n"; + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($fronter) < 1) {$fronter=$row[0];} + if (strlen($search_phone) < 10) {$search_phone=$row[1];} + } + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/closer.php b/LANG_admin/LANG_admin/vicidial/closer.php new file mode 100644 index 0000000..b73201b --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/closer.php @@ -0,0 +1,334 @@ + 2;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$color_class[0] = 'green'; +$color_class[1] = 'red'; +$color_class[2] = 'blue'; +$color_class[3] = 'purple'; +$color_class[4] = 'orange'; +$color_class[5] = 'green'; +$color_class[6] = 'red'; +$color_class[7] = 'blue'; +$color_class[8] = 'purple'; +$color_class[9] = 'orange'; +?> + + + + + +VICIDIAL CLOSER: Main + + +
+ + 0) + { + $stmt="SELECT dialplan_number,server_ip from phones where extension='$extension';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dialplan_number=$row[0]; + $server_ip=$row[1]; + + if (!$group_selected) + { + $stmt="select distinct channel_group from park_log;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $groups_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + echo "
Please select the groups you want to pick calls up from:
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inbound Call Groups:
\n"; + $o=0; + while ($groups_to_print > $o) + { + $group_form_print = sprintf("%-20s", $groups[$o]); + echo "$group_form_print
\n"; + $o++; + } + echo "
\n"; + echo "\n"; + echo "


\n"; + } + else + { + $o=0; + while($o < $group_selected) + { + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; + } + + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGIN','CLOSER','$NOW_TIME','$STARTtime');"; + $rslt=mysql_query($stmt, $link); + + echo"\n"; + echo"\n"; + + echo "extension found, forwarding you to closer page, please wait 3 seconds...
\n"; + } + + } + else + { + echo "The extension you entered does not exist, please try again
\n"; + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + + } + else + { + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + +exit; + +} + +$o=0; +while($o < $group_selected) +{ + $listen_groups = "$listen_groups     $groupselect[$o]"; + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; +} + + +echo"\n"; +echo"\n"; + +#CHANNEL SERVER CHANNEL_GROUP EXTENSION PARKED_BY PARKED_TIME +#---------------------------------------------------------------------------------------------- +#Zap/73-1 10.10.11.11 IN_800_TPP_CS TPPpark 7275338730 2004-04-22 12:41:00 + + + +echo "$NOW_TIME           $PHP_AUTH_USER - $fullname - CALLS SENT TO: $dialplan_number

\n"; + +echo "Click on the channel below that you would like to have directed to your phone
\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME         \n";
+echo "---------------------------------------------------------------------------------------------- \n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$server_ip'";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$server_ip' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$park_extension =	sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		$G='';   $EG='';
+		$o=0;
+		$with_color=0;
+		while($o < $group_selected)
+			{
+				if (eregi("$groupselect[$o]",$channel_group))
+					{
+					$G=""; $EG='';
+					$with_color++;
+					}
+				$o++;
+			}
+		if ($with_color)
+			{
+			if (eregi('CL_GAL',$row[2]))
+				{
+				echo "$G$channel$server$channel_group$park_extension                     $parked_time $EG\n";
+				}
+			else
+				{
+				echo "$G$channel$server$channel_group$park_extension$parked_by$parked_time $EG\n";
+				}
+			}
+#	
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "*************************************** NO PARKED CALLS ************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	}
+
+echo "  \n\n";
+echo "looking for calls on these groups:\n";
+$o=0;
+while($o < $group_selected)
+{
+	$group_print =		sprintf("%-20s", $groupselect[$o]);
+	echo "             - $group_print\n";
+	$o++;
+}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/closer_dispo.php b/LANG_admin/LANG_admin/vicidial/closer_dispo.php new file mode 100644 index 0000000..d05f57e --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/closer_dispo.php @@ -0,0 +1,289 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL CLOSER: Call Disposition + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from live_channels where server_ip='$server_ip' and channel='$channel' and extension like \"%$extension%\""; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $parked_count = $row[0]; + + if ($parked_count > 0) + { + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$DTqueryCID','Channel: $channel','','','','','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Hangup command sent for channel $channel       $NOW_TIME\n

\n"; + + echo "\n"; + } + else + { + echo "Hangup command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; + } +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/closer_popup.php b/LANG_admin/LANG_admin/vicidial/closer_popup.php new file mode 100644 index 0000000..93635da --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/closer_popup.php @@ -0,0 +1,431 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + + #$monitor_channel = eregi_replace('Zap/', "", $channel); + $monitor_channel = eregi_replace('-1', "", $channel); + $SIPexten = $extension; + $filename = "$REC_TIME$US$SIPexten"; + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: $monitor_channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$monitor_channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; +# $rslt=mysql_query($stmt, $link); +# if ($DB) {echo "$stmt\n";} +# $row=mysql_fetch_row($rslt); +# $recording_id = $row[0]; + +# echo "Recording command sent for channel $channel - $filename - $recording_id
\n"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$parked_by'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $parked_by - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$parked_by&channel=$channel&server_ip=$server_ip&extension=$extension&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + + $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$PHP_AUTH_USER' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; + if ($DB) {echo "|$stmt|\n";} + $fp = fopen ("./closer_SQL_updates.txt", "a"); + fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); + fclose($fp); + + + $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/count.htm b/LANG_admin/LANG_admin/vicidial/count.htm new file mode 100644 index 0000000..51f8a36 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/count.htm @@ -0,0 +1 @@ + diff --git a/LANG_admin/LANG_admin/vicidial/dbconnect.php b/LANG_admin/LANG_admin/vicidial/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/vicidial/group_hourly_stats.php b/LANG_admin/LANG_admin/vicidial/group_hourly_stats.php new file mode 100644 index 0000000..1da7356 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/group_hourly_stats.php @@ -0,0 +1,227 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats + + +
+ + + + + += '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_no_hour 00:00:00' and call_date <= '$date_no_hour 23:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
  VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/help.gif b/LANG_admin/LANG_admin/vicidial/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/vicidial/help.gif differ diff --git a/LANG_admin/LANG_admin/vicidial/htglobalize.php b/LANG_admin/LANG_admin/vicidial/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/listloader.php b/LANG_admin/LANG_admin/vicidial/listloader.php new file mode 100644 index 0000000..70ded99 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/listloader.php @@ -0,0 +1,187 @@ +\"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + +
Load leads from this file:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("./vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/listloader.pl b/LANG_admin/LANG_admin/vicidial/listloader.pl new file mode 100644 index 0000000..441d4ac --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/listloader.pl @@ -0,0 +1,126 @@ +#!/usr/bin/perl +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$|=0; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate="$year-$mon-$mday $hour:$min:$sec"; + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $campaign_id = ''; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + diff --git a/LANG_admin/LANG_admin/vicidial/listloaderMAIN.php b/LANG_admin/LANG_admin/vicidial/listloaderMAIN.php new file mode 100644 index 0000000..c743747 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/listloaderMAIN.php @@ -0,0 +1,69 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/listloader_rowdisplay.pl b/LANG_admin/LANG_admin/vicidial/listloader_rowdisplay.pl new file mode 100644 index 0000000..ca0da8c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/listloader_rowdisplay.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$dbhA->query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1"); + +if ($dbhA->has_selected_record) { + $rslt = $dbhA->create_record_iterator(); + my @row = $rslt->get_field_names(); + for ($i=0; $i\r\n"; + print " ".$field_name.": \r\n"; + print " \r\n"; + print " \r\n"; + } +} + diff --git a/LANG_admin/LANG_admin/vicidial/listloader_super.pl b/LANG_admin/LANG_admin/vicidial/listloader_super.pl new file mode 100644 index 0000000..3729e98 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/listloader_super.pl @@ -0,0 +1,128 @@ +#!/usr/bin/perl +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate="$year-$mon-$mday $hour:$min:$sec"; + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $campaign_id = ''; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + diff --git a/LANG_admin/LANG_admin/vicidial/log_test.php b/LANG_admin/LANG_admin/vicidial/log_test.php new file mode 100644 index 0000000..079d835 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/log_test.php @@ -0,0 +1,33 @@ + + + +Hello + + diff --git a/LANG_admin/LANG_admin/vicidial/new_listloader_superL.php b/LANG_admin/LANG_admin/vicidial/new_listloader_superL.php new file mode 100644 index 0000000..1f2a226 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/new_listloader_superL.php @@ -0,0 +1,747 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Super Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + + + + + + + + + + + + + + + +
Load leads from this file:
File layout to use:Standard VICIDIAL    Custom layout
        
CLICK HERE TO GO TO THE BASIC LEAD LOADER         BACK TO ADMIN
SUPER LIST LOADER-     VERSION:     BUILD:
+ + +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + print "
Processing Excel file... \n"; + # print "$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"; + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + passthru("$WeBServeRRooT/vicidial/listloader.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $tbl_rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + $total=0; $good=0; $bad=0; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + diff --git a/LANG_admin/LANG_admin/vicidial/record_conf_1_hour.php b/LANG_admin/LANG_admin/vicidial/record_conf_1_hour.php new file mode 100644 index 0000000..ca6d228 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/record_conf_1_hour.php @@ -0,0 +1,124 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL RECORD CONFERENCE: 1 hour + + +
+ + 8) && (strlen($session_id) > 3) && (strlen($station) > 3) ) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $conf_silent_prefix = '7'; + $ext_context = 'demo'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','RB$FILE_datetime$station','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: 8309','Priority: 1','Callerid: $FILE_datetime$station','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$session_id','$server_ip','$station','$MYSQL_datetime','$secX','$FILE_datetime$station')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "Recording started\n

\n"; + echo "Back to main recording screen\n

\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$station|\n

\n"; + echo "Back to main recording screen\n

\n"; + } +} +else +{ +echo "
Start recording a conference for 1 hour:
\n"; +echo "\n"; +echo "server_ip: | \n"; +echo "session_id: | \n"; +echo "station: | \n"; +echo "\n"; +echo "


\n"; + + + +} +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/remote_dispo.php b/LANG_admin/LANG_admin/vicidial/remote_dispo.php new file mode 100644 index 0000000..2839dab --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/remote_dispo.php @@ -0,0 +1,279 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='$call_length', status='$status', user='$PHP_AUTH_USER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments',user='$PHP_AUTH_USER' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/server_stats.php b/LANG_admin/LANG_admin/vicidial/server_stats.php new file mode 100644 index 0000000..4ee2c25 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/server_stats.php @@ -0,0 +1,70 @@ + + + + + + +VICIDIAL: Server Stats and Reports + +

VICIDIAL: Server Stats and Reports

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial/user_stats.php b/LANG_admin/LANG_admin/vicidial/user_stats.php new file mode 100644 index 0000000..c31c425 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/user_stats.php @@ -0,0 +1,302 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats + + +
+ + + + + +\n"; +echo "
  VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='$user' and event_date >= '$begin_date 0:00:01' and event_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGNHOURS:MINUTES
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "LAST 50 CALLS:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='$user' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS PHONE CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/user_status.php b/LANG_admin/LANG_admin/vicidial/user_status.php new file mode 100644 index 0000000..7fcf684 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/user_status.php @@ -0,0 +1,223 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + $stmt="SELECT * from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status + + +
+
+ + + + +\n"; +echo "
  VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='$group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name - \n"; + +echo "VICIDIAL Time Sheet\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial/vdremote.php b/LANG_admin/LANG_admin/vicidial/vdremote.php new file mode 100644 index 0000000..ae35d2c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial/vdremote.php @@ -0,0 +1,584 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + +$popup_page = './closer_popup.php'; +$version = '1.1.9'; +$build = '51123-1502'; +$STARTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_CLOSERstats.php b/LANG_admin/LANG_admin/vicidial_el/AST_CLOSERstats.php new file mode 100644 index 0000000..ca15a2a --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_CLOSERstats.php @@ -0,0 +1,360 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Στατιστικά VDAD Closer\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΚΑΙ ΜΙΑ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Στατιστικά αυτόματης κλήσης Closer                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this ΕκστÏατείας:       $TOTALcalls\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για όλες τις κλήσεις: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Συνολικά DROP κλήσεις: $DROPcalls  $DROPpercent%\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για DROP κλήσεις: $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΗΣΤΗ\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| ΧΡΗΣΤΗΣ                  | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΟÎΟΥ\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩΠPLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_VDADstats.php b/LANG_admin/LANG_admin/vicidial_el/AST_VDADstats.php new file mode 100644 index 0000000..ec73153 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_VDADstats.php @@ -0,0 +1,390 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΚΑΙ ΜΙΑ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this ΕκστÏατείας:       $TOTALcalls\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για όλες τις κλήσεις: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Συνολικά DROP κλήσεις: $DROPcalls  $DROPpercent%\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για DROP κλήσεις: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- ΜΗ ΑΠΑÎΤΗΜΕÎΕΣ ΑΥΤΟΜΑΤΕΣ ΚΛΗΣΕΙΣ\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='NA' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+$NApercent = (($NAcalls / $TOTALcalls) * 100);
+$NApercent = round($NApercent, 0);
+
+$average_na_seconds = ($row[1] / $row[0]);
+$average_na_seconds = round($average_na_seconds, 0);
+$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+
+echo "Συνολικά ÎΑ κλήσεις -Busy,Disconnect,BTvoicemail: $NAcalls  $NApercent%\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για ÎΑ κλήσεις: $average_na_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΗΣΤΗ\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| ΧΡΗΣΤΗΣ                  | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΟÎΟΥ\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩΠPLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_VICIDIAL_hopperlist.php b/LANG_admin/LANG_admin/vicidial_el/AST_VICIDIAL_hopperlist.php new file mode 100644 index 0000000..75c6eea --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,135 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} +if (!$server_ip) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Λίστα Hopper\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΑÎΩΤΕΡΩ ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Λίστα Hopper                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Συνολικά καθοδηγητές στον hopper τώÏα::       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+echo "|      | LEAD_ID   | PHONE NUM  | STATE | STATUS | COUNT | GMT    |\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now from vicidial_hopper,vicidial_list where vicidial_hopper.CAMPAIGN_ID='$group' and vicidial_hopper.lead_id=vicidial_list.lead_id order by hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+
+	echo "| $FMT_i | $lead_id | $phone_number | $state | $status | $count | $gmt |\n";
+
+	$i++;
+	}
+
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_admin_log_display.php b/LANG_admin/LANG_admin/vicidial_el/AST_admin_log_display.php new file mode 100644 index 0000000..351c4d9 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_admin_log_display.php @@ -0,0 +1,105 @@ + 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ΔΙΑΧ LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ΔΙΑΧ CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance.php b/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance.php new file mode 100644 index 0000000..02cdacb --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance.php @@ -0,0 +1,205 @@ + + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='$group' group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance_detail.php b/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance_detail.php
new file mode 100644
index 0000000..6375073
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_el/AST_agent_performance_detail.php
@@ -0,0 +1,379 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$query_date=$_GET["query_date"];	if (!$query_date) {$query_date=$_POST["query_date"];}
+$group=$_GET["group"];				if (!$group) {$group=$_POST["group"];}
+$shift=$_GET["shift"];				if (!$shift) {$shift=$_POST["shift"];}
+$submit=$_GET["submit"];			if (!$submit) {$submit=$_POST["submit"];}
+$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];			if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 03:45:00";   
+	$query_date_END = "$query_date 15:15:00";
+	$time_BEGIN = "03:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:15:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TIME   | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG| A    | B    | DC   | DNC  | N    | NI   | CB   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='$group' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtime=($TOTtime + $row[1] + $row[5] + $row[7] + $row[9]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$TOTtotWAIT=($TOTtotWAIT + $row[7]);
+	$TOTtotPAUSE=($TOTtotPAUSE + $row[5]);
+	$TOTtotDISPO=($TOTtotDISPO + $row[9]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtime =	($row[1] + $row[5] + $row[7] + $row[9]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+	$USERtotPAUSE =	$row[5];
+	$USERavgPAUSE =	$row[6];
+	$USERtotWAIT =	$row[7];
+	$USERavgWAIT =	$row[8];
+	$USERtotDISPO =	$row[9];
+	$USERavgDISPO =	$row[10];
+
+	$USERtime_M = ($USERtime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS[$i] =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($USERtotPAUSE / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS[$i] =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($USERavgPAUSE / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS[$i] =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($USERtotWAIT / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS[$i] =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($USERavgWAIT / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS[$i] =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($USERtotDISPO / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS[$i] =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($USERavgDISPO / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS[$i] =		sprintf("%6s", $USERavgDISPO_MS);
+
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; $ctCB[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if (($row[1] == 'CALLBK') || ($row[1] == 'CBHOLD') ) {$ctCB[$k]=sprintf("%-4s", $row[0]);	$TOT_CB = ($TOT_CB + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtime_MS[$k]| $pfUSERtotPAUSE_MS[$k] | $pfUSERavgPAUSE_MS[$k] | $pfUSERtotWAIT_MS[$k] | $pfUSERavgWAIT_MS[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $pfUSERtotDISPO_MS[$k] | $pfUSERavgDISPO_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctCB[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = round($TOTtime_M, 2);
+	$TOTtime_M_int = intval("$TOTtime_M");
+	$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
+	$TOTtime_S = ($TOTtime_S * 60);
+	$TOTtime_S = round($TOTtime_S, 0);
+	if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%7s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>7) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%7s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>7) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%7s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>7) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%7s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>7) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+	
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_CB = sprintf("%-5s", $TOT_CB);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtime_MS| $TOTtotPAUSE_MS| $TOTavgPAUSE_MS | $TOTtotWAIT_MS| $TOTavgWAIT_MS | $TOTtotTALK_MS| $TOTavgTALK_MS | $TOTtotDISPO_MS| $TOTavgDISPO_MS | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_CB| $TOT_SALE|\n";
+echo "+--------------------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_agent_time_sheet.php b/LANG_admin/LANG_admin/vicidial_el/AST_agent_time_sheet.php
new file mode 100644
index 0000000..a493603
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_el/AST_agent_time_sheet.php
@@ -0,0 +1,256 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$agent=$_GET["agent"];						if (!$agent) {$agent=$_POST["agent"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$calls_summary=$_GET["calls_summary"];		if (!$calls_summary) {$calls_summary=$_POST["calls_summary"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];					if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_server_performance.php b/LANG_admin/LANG_admin/vicidial_el/AST_server_performance.php
new file mode 100644
index 0000000..8358239
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_el/AST_server_performance.php
@@ -0,0 +1,283 @@
+
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Server Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:32:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:32:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$HIGHload =	sprintf("%10s", $row[0]);
+$HIGHmulti = intval($HIGHload / 100);
+#$HIGHmulti = ($HIGHload / 100);
+
+$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$USEDram =	sprintf("%10s", $row[0]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365') and  start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average channels in use for server:       $AVGchannels\n";
+echo "Average load for server:                  $AVGload\n";
+echo "Peak load for server:                     $HIGHload\n";
+#echo "Peak used memory for server (in MB):      $USEDram\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHload\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc 30 minutes\n";
+$HTMcontent .= "minorticinc: 5 minutes\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD.php b/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD.php new file mode 100644 index 0000000..9ebf818 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD.php @@ -0,0 +1,231 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: ΧÏόνος χÏηστών σε κλήσεις                       $NOW_TIME\n\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	$agentcount=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- ΑÎΑΜΟÎΗ -';
+			$row[6]=$row[7];
+			}
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$sessionid =		sprintf("%-9s", $row[2]);
+		$channel =			sprintf("%-10s", $row[3]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[4]);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 5) {$G=''; $EG='';}
+		if ($call_time_M_int >= 10) {$G=''; $EG='';}
+		if (eregi("PAUSED",$row[4])) 
+			{
+			if ($call_time_M_int >= 1) 
+				{$i++; continue;} 
+			else
+				{$G=''; $EG='';}
+			}
+
+		$agentcount++;
+		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+		echo "  $agentcount ΧÏήστες συνδεμένοι στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΧÏήστες σε παÏση\n";
+		echo "             - 5 λεπτά ή παÏαπάνω σε κλήση\n";
+		echo "             - Πάνω από 10 λεπτά σε κλήση\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* ΚΑÎΕÎΑΣ ΧΡΗΣΤΗΣ ΣΕ ΚΛΗΣΕΙΣ*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-8s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+		echo "  $i κλήσεις που τοποθετήθηκαν στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΑÎΑΜΟÎΗ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD_closer.php b/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD_closer.php new file mode 100644 index 0000000..0b41c80 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/AST_timeonVDAD_closer.php @@ -0,0 +1,289 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: ΧÏόνος χÏηστών σε κλήσεις                       $NOW_TIME\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] =		sprintf("%-10s", $row[0]);
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where uniqueid='$uniqueid[$i]' and server_ip='$server_ip';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i ΧÏήστες συνδεμένοι στον διακομιστή $server_ip\n\n";
+
+	#	echo "             - 5 λεπτά ή παÏαπάνω σε κλήση\n";
+	#	echo "             - Πάνω από 10 λεπτά σε κλήση\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* ΚΑÎΕÎΑΣ ΧΡΗΣΤΗΣ ΣΕ ΚΛΗΣΕΙΣ*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i κλήσεις που τοποθετήθηκαν στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΑÎΑΜΟÎΗ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/admin.php b/LANG_admin/LANG_admin/vicidial_el/admin.php new file mode 100644 index 0000000..2300d04 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/admin.php @@ -0,0 +1,4156 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$full_name=$_GET["full_name"]; if (!$full_name) {$full_name=$_POST["full_name"];} +$user_level=$_GET["user_level"]; if (!$user_level) {$user_level=$_POST["user_level"];} +$user_group=$_GET["user_group"]; if (!$user_group) {$user_group=$_POST["user_group"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$campaign_name=$_GET["campaign_name"]; if (!$campaign_name) {$campaign_name=$_POST["campaign_name"];} +$active=$_GET["active"]; if (!$active) {$active=$_POST["active"];} +$park_ext=$_GET["park_ext"]; if (!$park_ext) {$park_ext=$_POST["park_ext"];} +$park_file_name=$_GET["park_file_name"]; if (!$park_file_name) {$park_file_name=$_POST["park_file_name"];} +$web_form_address=$_GET["web_form_address"]; if (!$web_form_address) {$web_form_address=$_POST["web_form_address"];} +$allow_closers=$_GET["allow_closers"]; if (!$allow_closers) {$allow_closers=$_POST["allow_closers"];} +$hopper_level=$_GET["hopper_level"]; if (!$hopper_level) {$hopper_level=$_POST["hopper_level"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$next_agent_call=$_GET["next_agent_call"]; if (!$next_agent_call) {$next_agent_call=$_POST["next_agent_call"];} +$local_call_time=$_GET["local_call_time"]; if (!$local_call_time) {$local_call_time=$_POST["local_call_time"];} +$voicemail_ext=$_GET["voicemail_ext"]; if (!$voicemail_ext) {$voicemail_ext=$_POST["voicemail_ext"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$list_name=$_GET["list_name"]; if (!$list_name) {$list_name=$_POST["list_name"];} +$group_id=$_GET["group_id"]; if (!$group_id) {$group_id=$_POST["group_id"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$group_color=$_GET["group_color"]; if (!$group_color) {$group_color=$_POST["group_color"];} +$fronter_display=$_GET["fronter_display"]; if (!$fronter_display) {$fronter_display=$_POST["fronter_display"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$dial_status_a=$_GET["dial_status_a"]; if (!$dial_status_a) {$dial_status_a=$_POST["dial_status_a"];} +$dial_status_b=$_GET["dial_status_b"]; if (!$dial_status_b) {$dial_status_b=$_POST["dial_status_b"];} +$dial_status_c=$_GET["dial_status_c"]; if (!$dial_status_c) {$dial_status_c=$_POST["dial_status_c"];} +$dial_status_d=$_GET["dial_status_d"]; if (!$dial_status_d) {$dial_status_d=$_POST["dial_status_d"];} +$dial_status_e=$_GET["dial_status_e"]; if (!$dial_status_e) {$dial_status_e=$_POST["dial_status_e"];} +$lead_order=$_GET["lead_order"]; if (!$lead_order) {$lead_order=$_POST["lead_order"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$campaign_vdad_exten=$_GET["campaign_vdad_exten"]; if (!$campaign_vdad_exten) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +$campaign_rec_exten=$_GET["campaign_rec_exten"]; if (!$campaign_rec_exten) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +$campaign_recording=$_GET["campaign_recording"]; if (!$campaign_recording) {$campaign_recording=$_POST["campaign_recording"];} +$campaign_rec_filename=$_GET["campaign_rec_filename"]; if (!$campaign_rec_filename) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +$hotkey=$_GET["hotkey"]; if (!$hotkey) {$hotkey=$_POST["hotkey"];} +$reset_list=$_GET["reset_list"]; if (!$reset_list) {$reset_list=$_POST["reset_list"];} +$old_campaign_id=$_GET["old_campaign_id"]; if (!$old_campaign_id) {$old_campaign_id=$_POST["old_campaign_id"];} +$OLDuser_group=$_GET["OLDuser_group"]; if (!$OLDuser_group) {$OLDuser_group=$_POST["OLDuser_group"];} +$status_name=$_GET["status_name"]; if (!$status_name) {$status_name=$_POST["status_name"];} +$selectable=$_GET["selectable"]; if (!$selectable) {$selectable=$_POST["selectable"];} +$HKstatus=$_GET["HKstatus"]; if (!$HKstatus) {$HKstatus=$_POST["HKstatus"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} +$delete_users=$_GET["delete_users"]; if (!$delete_users) {$delete_users=$_POST["delete_users"];} +$delete_user_groups=$_GET["delete_user_groups"]; if (!$delete_user_groups) {$delete_user_groups=$_POST["delete_user_groups"];} +$delete_lists=$_GET["delete_lists"]; if (!$delete_lists) {$delete_lists=$_POST["delete_lists"];} +$delete_campaigns=$_GET["delete_campaigns"]; if (!$delete_campaigns) {$delete_campaigns=$_POST["delete_campaigns"];} +$delete_ingroups=$_GET["delete_ingroups"]; if (!$delete_ingroups) {$delete_ingroups=$_POST["delete_ingroups"];} +$delete_remote_agents=$_GET["delete_remote_agents"]; if (!$delete_remote_agents) {$delete_remote_agents=$_POST["delete_remote_agents"];} +$load_leads=$_GET["load_leads"]; if (!$load_leads) {$load_leads=$_POST["load_leads"];} +$campaign_detail=$_GET["campaign_detail"]; if (!$campaign_detail) {$campaign_detail=$_POST["campaign_detail"];} +$ast_admin_access=$_GET["ast_admin_access"]; if (!$ast_admin_access) {$ast_admin_access=$_POST["ast_admin_access"];} +$ast_delete_phones=$_GET["ast_delete_phones"]; if (!$ast_delete_phones) {$ast_delete_phones=$_POST["ast_delete_phones"];} +$CoNfIrM=$_GET["CoNfIrM"]; if (!$CoNfIrM) {$CoNfIrM=$_POST["CoNfIrM"];} +$delete_scripts=$_GET["delete_scripts"]; if (!$delete_scripts) {$delete_scripts=$_POST["delete_scripts"];} +$script_id=$_GET["script_id"]; if (!$script_id) {$script_id=$_POST["script_id"];} + $script_id = strtoupper($script_id); +$script_name=$_GET["script_name"]; if (!$script_name) {$script_name=$_POST["script_name"];} +$script_comments=$_GET["script_comments"]; if (!$script_comments) {$script_comments=$_POST["script_comments"];} +$script_text=$_GET["script_text"]; if (!$script_text) {$script_text=$_POST["script_text"];} +$reset_hopper=$_GET["reset_hopper"]; if (!$reset_hopper) {$reset_hopper=$_POST["reset_hopper"];} +$get_call_launch=$_GET["get_call_launch"]; if (!$get_call_launch) {$get_call_launch=$_POST["get_call_launch"];} +$am_message_exten=$_GET["am_message_exten"]; if (!$am_message_exten) {$am_message_exten=$_POST["am_message_exten"];} +$amd_send_to_vmx=$_GET["amd_send_to_vmx"]; if (!$amd_send_to_vmx) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"]; if (!$xferconf_a_dtmf) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +$xferconf_a_number=$_GET["xferconf_a_number"]; if (!$xferconf_a_number) {$xferconf_a_number=$_POST["xferconf_a_number"];} +$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"]; if (!$xferconf_b_dtmf) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +$xferconf_b_number=$_GET["xferconf_b_number"]; if (!$xferconf_b_number) {$xferconf_b_number=$_POST["xferconf_b_number"];} +$modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST["modify_leads"];} +$hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} +$change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} +$agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} + + + + +### AST GUI database administration +### admin.php +### +### CHANGES +### 50315-1110 - Added Custom Campaign Statuses +### 50317-1438 - Added Fronter Display var to inbound groups +### 50322-1355 - Added custom callerID per campaign +### 50517-1356 - Added user_groups sections and user_group to vicidial_users +### 50517-1440 - Added ability to logout (must click OK with empty user/pass) +### 50602-1622 - Added lead loader pages to load new files into vicidial_list +### 50620-1351 - Added custom vdad transfer AGI extension per campaign +### 50810-1414 - modified in groups to kick out spaces and dashes +### 50908-2136 - Added Custom Campaign HotKeys +### 50914-0950 - Fixed user search by user_group +### 50926-1358 - Modified to allow for language translation +### 50926-1615 - Added WeBRooTWritablE write controls +### 51020-1008 - Added editable web address and park ext - NEW dial campaigns +### 51020-1056 - Added fields and help for campaign recording control +### 51123-1335 - Altered code to function in php globals=off +### 51208-1038 - Added user_level changes, function controls and default user phones +### 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +### 51213-1706 - Added add/delete/modify vicidial scripts +### 51214-1737 - Added preview of vicidial script in popup window +### 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +### 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +### 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +### 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +### 60204-0659 - Fixed hopper reset bug +### 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +### 60213-1100 - Added several vicidial_users permissions fields +### 60215-1319 - Added On-hold CallBacks display and links +### 60227-1226 - Fixed vicidial_inbound_groups insert bug + +### 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 + +$version = '1.1.10-5'; +$build = '60227-1226'; + +$STARTtime = date("U"); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGdelete_scripts =$row[18]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ΔΙΑΧ: "; + +if ($ADD==1) {echo "ΠÏόσθετε Îέο ΧÏήστη";} +if ($ADD==11) {echo "ΠÏόσθετε Îέα ΕκστÏατεία";} +if ($ADD==111) {echo "ΠÏόσθετε Îέα Λίστα";} +if ($ADD==1111) {echo "ΠÏόσθετε Îέα Εισ-Ομάδα";} +if ($ADD==11111) {echo "ΠÏόσθετε Îέους ΑπομακÏυσμένους ΧÏήστες";} +if ($ADD==111111) {echo "ΠÏόσθετε Îέο ΧÏήστηs Group";} +if ($ADD==1111111) {echo "ΠÏοσθέστε το νέο χειÏόγÏαφο";} +if ($ADD==2) {echo "ΠÏοσθήκη Îέου ΧÏήστη";} +if ($ADD==21) {echo "ΠÏοσθήκη Îέας ΕκστÏατείας";} +if ($ADD==22) {echo "ΠÏοσθήκη Îέας Κατάστασης ΕκστÏατείας";} +if ($ADD==23) {echo "ΠÏοσθήκη Îέου ÎšÎ»ÎµÎ¹Î´Î¹Î¿Ï Î•ÎºÏƒÏ„Ïατείας";} +if ($ADD==211) {echo "ΠÏοσθήκη Îέας Λίστας";} +if ($ADD==2111) {echo "ΠÏοσθήκη Îέας Εισ-Ομάδας";} +if ($ADD==21111) {echo "ΠÏοσθήκη Îέων ΑπομακÏυσμένων ΧÏηστών";} +if ($ADD==211111) {echo "ΠÏοσθήκη Îέας Ομάδας ΧÏηστών";} +if ($ADD==2111111) {echo "Îέα Ï€Ïοσθήκη χειÏογÏάφων";} +if ($ADD==3) {echo "ΤÏοποποίηση ΧÏήστη";} +if ($ADD==31) {echo "ΤÏοποποίηση ΕκστÏατείας";} +if ($ADD==34) {echo "ΤÏοποποίηση ΕκστÏατείας - Βασική Επισκόπηση";} +if ($ADD==311) {echo "ΤÏοποποίηση Λίστας";} +if ($ADD==3111) {echo "ΤÏοποποίηση Εισ-Ομάδων";} +if ($ADD==31111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧÏηστών";} +if ($ADD==311111) {echo "ΤÏοποποίηση ΧÏήστηs Groups";} +if ($ADD==3111111) {echo "ΤÏοποποιήστε το χειÏόγÏαφο";} +if ($ADD=="4A") {echo "ΤÏοποποίηση ΧÏήστη - Admin";} +if ($ADD==4) {echo "ΤÏοποποίηση ΧÏήστη";} +if ($ADD==41) {echo "ΤÏοποποίηση ΕκστÏατείας";} +if ($ADD==42) {echo "ΤÏοποποίηση ΕκστÏατείας Status";} +if ($ADD==43) {echo "ΤÏοποποίηση ΕκστÏατείας HotKey";} +if ($ADD==44) {echo "ΤÏοποποίηση ΕκστÏατείας - Βασική Επισκόπηση";} +if ($ADD==411) {echo "ΤÏοποποίηση Λίστας";} +if ($ADD==4111) {echo "ΤÏοποποίηση Εισ-Ομάδων";} +if ($ADD==41111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧÏηστών";} +if ($ADD==411111) {echo "ΤÏοποποίηση ΧÏήστηs Groups";} +if ($ADD==4111111) {echo "ΤÏοποποιήστε το χειÏόγÏαφο";} +if ($ADD==5) {echo "Delete User";} +if ($ADD==51) {echo "Delete Campaign";} +if ($ADD==52) {echo "ΠÏάκτοÏες αποσÏνδεσης";} +if ($ADD==511) {echo "Delete List";} +if ($ADD==5111) {echo "Delete In-Group";} +if ($ADD==51111) {echo "ΔιαγÏάψτε τους μακÏινοÏÏ‚ Ï€ÏάκτοÏες";} +if ($ADD==511111) {echo "ΔιαγÏάψτε τους χÏήστες Group";} +if ($ADD==5111111) {echo "ΔιαγÏάψτε το χειÏόγÏαφο";} +if ($ADD==6) {echo "Delete User";} +if ($ADD==61) {echo "Delete Campaign";} +if ($ADD==62) {echo "ΠÏάκτοÏες αποσÏνδεσης";} +if ($ADD==611) {echo "Delete List";} +if ($ADD==6111) {echo "Delete In-Group";} +if ($ADD==61111) {echo "ΔιαγÏάψτε τους μακÏινοÏÏ‚ Ï€ÏάκτοÏες";} +if ($ADD==611111) {echo "ΔιαγÏάψτε τους χÏήστες Group";} +if ($ADD==6111111) {echo "ΔιαγÏάψτε το χειÏόγÏαφο";} +if ($ADD==7111111) {echo "ΧειÏόγÏαφο Ï€Ïόβλεψης";} +if ($ADD==0) {echo "ΚαλωσήÏθες";} +if ($ADD==8) {echo "CallBacks μέσα στον Ï€ÏάκτοÏα";} +if ($ADD==81) {echo "CallBacks μέσα στην εκστÏατεία";} +if ($ADD==811) {echo "CallBacks μέσα στον κατάλογο";} +if ($ADD==10) {echo "ΕκστÏατείες";} +if ($ADD==100) {echo "Λίστες";} +if ($ADD==1000) {echo "Εισ-Ομάδες";} +if ($ADD==10000) {echo "ΑπομακÏυσμένοι ΧÏήστες";} +if ($ADD==100000) {echo "Ομάδες ΧÏήστη";} +if ($ADD==1000000) {echo "ΧειÏόγÏαφα";} +if ($ADD==55) {echo "ΦόÏμα Αναζήτησης";} +if ($ADD==66) {echo "Αποτελέσματα Αναζήτησης";} +if ($ADD==99999) {echo "ΒΟΗΘΕΙΑ";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rsltx=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rsltx); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or ($ADD=="4A") ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<100) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"ΒΟΗΘΕΙΑ\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ΔΙΑΧ: ΒΟΗΘΕΙΑ


\n"; + +?> +VICIDIAL_USERS ΠΙÎΑΚΑΣ

+ +
+ID ΧÏήστη - Σε αυτό το πεδίο τοποθετείται ο αÏιθμός ID του χÏήστη, μποÏεί να είναι μεταξ 2 και 8 ψηφία. + +
+
+
+Κωδικός - Σε αυτό το πεδίο τοποθετείται ο κωδικός του χÏήστη στο VICIDIAL. ΠÏέπει να είναι τουλάχιστον 2 χαÏακτήÏες. + +
+
+
+ΠλήÏες Ονομα - Αυτό το πεδίο είναι που μποÏείτε να οÏίσετε το πλήÏες όνομα των χÏηστών VICIDIAL. ΠÏέπει να είναι τουλάχιστον 2 χαÏακτήÏες. + +
+
+
+Επίπεδο ΧÏήστη - Αυτός ο κατάλογος επιλογών είναι που μποÏείτε να επιλέξετε το επίπεδο χÏήστη των VICIDIAL χÏηστών. ΠÏέπει να έχει επίπεδο 1 για να συνδεθεί στο σÏστημα. ΠÏέπει να έχει επίπεδο μεγαλÏτεÏο από 2 για να συνδεθεί ως closer. ΠÏέπει να έχει επίπεδο 8 ή μεγαλÏτεÏο για ενέÏγειες διαχειÏιστή. + +
+
+
+Ομάδα ΧÏήστη - Αυτός ο κατάλογος επιλογών είναι που μποÏείτε να επιλέξετε την ομάδα χÏηστών που ανήκει ο χÏήστης. + +
+
+
+Τηλεφωνική σÏνδεση - εδώ είναι όπου εσείς μποÏεί να θέσει μια αξία τηλεφωνικής σÏνδεσης Ï€Ïοεπιλογής για όταν τα κοÏτσουÏα χÏηστών σε vicidial.php. Αυτή η αξία θα εποικήσει το phone_login αυτόματα όταν συνδέεται ο χÏήστης με την χÏήστης-πέÏασμα-εκστÏατεία τους στην οθόνη σÏνδεσης vicidial.php. + +
+
+
+Τηλεφωνικό πέÏασμα - εδώ είναι όπου εσείς μποÏεί να θέσει μια αξία τηλεφωνικών πεÏασμάτων Ï€Ïοεπιλογής για όταν τα κοÏτσουÏα χÏηστών σε vicidial.php. Αυτή η αξία θα εποικήσει τα phone_pass αυτόματα όταν συνδέεται ο χÏήστης με την χÏήστης-πέÏασμα-εκστÏατεία τους στην οθόνη σÏνδεσης vicidial.php. + +
+
+
+ΔιαγÏάψτε τους χÏήστες - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει άλλους χÏήστες του ίσου ή του μικÏότεÏου επιπέδου χÏηστών από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τις ομάδες χÏηστών - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τις ομάδες χÏηστών από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τους καταλόγους - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τους vicidial καταλόγους από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τις εκστÏατείες - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τις vicidial εκστÏατείες από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τις-ΟΜΑΔΕΣ - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τις vicidial-OMA'DES από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τους μακÏινοÏÏ‚ Ï€ÏάκτοÏες - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τους vicidial μακÏινοÏÏ‚ Ï€ÏάκτοÏες από το σÏστημα. + +
+
+
+Το φοÏτίο οδηγεί - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να φοÏτώσει τους vicidial μολÏβδους στον πίνακα vicidial_list μέσω του βασισμένου στον Ιστό φοÏτωτή μολÏβδου. + +
+
+
+ΛεπτομέÏεια εκστÏατείας - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να δει και να Ï„Ïοποποιήσει τα στοιχεία οθόνης λεπτομέÏειας εκστÏατείας. + +
+
+
+ΠÏόσβαση AGC Admin - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη στη σÏνδεση στις σελίδες admin astGUIclient. + +
+
+
+Το AGC διαγÏάφει τα τηλέφωνα - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τα τηλεφωνικά λήμματα στις σελίδες admin astGUIclient. + +
+
+
+ΔιαγÏάψτε τα χειÏόγÏαφα - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να διαγÏάψει τα χειÏόγÏαφα εκστÏατείας στην οθόνη Ï„Ïοποποίησης χειÏογÏάφων. + +
+
+
+ΤÏοποποιήστε τους μολÏβδους - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να Ï„Ïοποποιήσει τους μολÏβδους στη σελίδα αποτελεσμάτων αναζήτησης μολÏβδου τμημάτων admin. + +
+
+
+HotKeys ενεÏγός - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να χÏησιμοποιήσει τη γÏήγοÏος- dispositioning λειτουÏγία HotKeys μέσα vicidial.php. + +
+
+
+ΕκστÏατεία Ï€ÏακτόÏων αλλαγής - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να αλλάξει την εκστÏατεία ότι ένας Ï€ÏάκτοÏας καταγÏάφεται ενώ καταγÏάφονται σε την. + +
+
+
+Ο Ï€ÏάκτοÏας επιλέγει Ingroups - αυτή η επιλογή εάν θέστε 1 επιτÏέπει στο χÏήστη για να επιλέξει τα ingroups ότι θα λάβουν τις κλήσεις από όταν αυτοί σÏνδεση σε μια ΠΙΟ ΣΤΕÎΉ ή ΕΙΣΕΡΧΟΜΕÎΗ εκστÏατεία. ΔιαφοÏετικά ο διευθυντής θα Ï€Ïέπει να θέσει αυτό στην οθόνη λεπτομέÏειας χÏηστών τους της σελίδας admin. + +
+
+
+ΕισεÏχόμενες Ομάδες - Εδώ μποÏείτε να επιλέξετε τις εισεÏχόμενες ομάδες που θέλετε να λαμβάνουν τις κλήσεις , εάν έχετε επιλέξει την εκστÏατεία CLOSER. + + + +



+ +VICIDIAL_CAMPAIGNS ΠΙÎΑΚΑΣ

+
+
+ID ΕκστÏατείας - Αυτό είναι το σÏντομο όνομα της εκστÏατείας, δεν μποÏεί ν διοÏθωθεί μετά από την αÏχική παÏάδοση, δεν μποÏεί να πεÏιέχει κενά και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏεςh. + +
+
+
+Ονομα ΕκστÏατείας - Αυτό είναι η πεÏιγÏαφή της εκστÏατείας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 6 και 40 χαÏακτήÏες. + +
+
+
+ΕνεÏγοποίηση - Εδώ μποÏείτε να θέσετε την εκστÏατεία ενεÏγή ή μη ενεÏγή. Εάν είναι μη ενεÏγή, κανένας δεν μποÏεί να συνδεθεί σε αυτήν. + +
+
+
+Τηλ.ΣÏνδεση Στάθμευσης - Εδώ μποÏείτε να Ï€Ïοσετε την μουσική αναμονής για το VICIDIAL. Επιβεβαιώστε, ότι η εσωτ.σÏνδεση βÏίσκεται στο extensions.conf και ότι δείχνει το αÏχείο παÏακάτω. + +
+
+
+Ον ΑÏχείου Στάθμευσης - Εδώ μποÏείτε να Ï€ÏοσαÏμόσετε την μουσική αναμονής για το VICIDIAL. Επιβεβαιώστε ότι το αÏχείο έχει 10 χαÏακτήÏες ή λιγότεÏους και ότι το αÏχείο βÏίσκεται στον κατάλογο /var/lib/asterisk/sounds. + +
+
+
+Ιστοσελίδα - Αυτή είναι η Ï€ÏοσαÏμοσμένη διεÏθυνση που θα σας κατευθÏνει για κλήσεις που έÏχονται σε αυτήν την ομάδα. + +
+
+
+ΕπιτÏέπει τους Closers - Εδώ οÏίζετε εάν οι χÏήστες της εκστÏατείας θα έχουν την επιλογή να στείλουν την κλήση σε έναν closer. + +
+
+
+Κατάσταση Κλήσης - Εδώ οÏίζετε τις καταστάσεις που θέλετε να κληθοÏν μέσα στις λίστες, οι οποίες είναι ενεÏγές γ τις εκστÏατείες παÏακάτω + +
+
+
+Ταξινόμηση Λίστας - Σε αυτόν τον κατάλογο επιλογών μποÏείτε να επιλέξετε πώς οι καθοδηγητές, που ταιÏιάζουν με τις καταστάσεις που επιλέξατε παÏαπάνω, θα τοποθετηθοÏν hopper καθοδηγητών: +
  - DOWN: επιλογή των Ï€Ïώτων καθοδηγητών που φοÏτώθηκαν στον πίνακα vicidial_list +
  - UP: επιλογή των τελευταίων καθοδηγητών που φοÏτώθηκαν στον πίνακα vicidial_list +
  - UP PHONE: επιλογή του υψηλότεÏου Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï ÎºÎ±Î¹ συνεχίζει Ï€Ïος τα κάτω +
  - DOWN PHONE: επιλογή του χαμηλότεÏου Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï ÎºÎ±Î¹ συνεχίζει Ï€Ïος τα πάνω +
  - UP LAST NAME: έναÏξη με τα επίθετα να ξεκινάνε με Ζ και συνεχίζει Ï€Ïος τα κάτω +
  - DOWN LAST NAME: έναÏξη με τα επίθετα να ξεκινάνε με Α και συνεχίζει Ï€Ïος τα πάνω +
  - UP COUNT: έναÏξη με τους λιγότεÏους σε κλήση καθοδηγητές και συνεχίζει Ï€Ïος τα κάτω +
  - DOWN COUNT: έναÏξη με τους λιγότεÏους σε κλήση καθοδηγητές και συνεχίζει +
  - DOWN COUNT 2nd NEW: έναÏξη με τους λιγότεÏους σε κλήση καθοδηγητές και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ καθοδηγητή για κάθε άλλο καθοδηγητή - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων +
  - DOWN COUNT 3nd NEW: έναÏξη με τους λιγότεÏους σε κλήση καθοδηγητές και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ καθοδηγητή για κάθε Ï„Ïίτο καθοδηγητή - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων +
  - DOWN COUNT 4th NEW: έναÏξη με τους λιγότεÏους σε κλήση καθοδηγητές και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ καθοδηγητή για κάθε τέταÏτο καθοδηγητή - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων + +
+
+
+Επίπεδο Hopper - Αυτό είναι το πόσους καθοδηγητές η διαδικασία VDhopper, Ï€Ïοσπαθεί να διατηÏήσει στον πίνακα vicidial_hopper για αυτήν την εκστÏατεία. Εάν η διαδικασία VDhopper Ï„Ïέχει κάθε λεπτό, Ïυθμίστε αυτό λίγο πεÏισσότεÏο από τον αÏιθμό των καθοδηγητών που πεÏνοÏν σε ένα λεπτό. + +
+
+
+ΥποχÏεωτική ΕπαναφοÏά του Hopper - Αυτό σας επιτÏέπει καθαÏίσετε τα πεÏιεχόμενα κατά επιβεβαίωση της φόÏμας. Αυτό θα συμβεί πάλι όταν η διαδικασία VDhopper θα Ï„Ïέξει. + +
+
+
+Επίπεδο Αυτόματης Κλήσης - Εδώ είναι που καθοÏίζεται πόσες γÏαμμές θα χÏησιμοποιοÏνται ανά ενεÏγό χÏήστη. Μηδέν (0) σημαίνει ότι η αυτόματη κλήση είναι μη ενεÏγή και οι χÏήστες πατοÏν το πλήκτÏο για την κλήση κάθε αÏιθμοÏ. ΔιαφοÏετικά, το σÏστημα καλεί γÏαμμές ίσες με τους ενεÏγοÏÏ‚ χÏήστες, πολλαπλασιασμένους με το επίπεδο κλήσης και σÏμφωνα με το πόσες γÏαμμές η εκστÏατεία σε κάθε διακομιστή επιτÏέπει. + +
+
+
+Επόμενη Κλήση ΧÏήστη - Αυτό Ï€ÏοσδιοÏίζει ποιος χÏήστης λαμβάνει την επόμενη κλήση που είναι διαθέσιμη: +
  - random: ταξινομημένο με τυχαία τιμή ενημέÏωσης στον πίνακα vicidial_live_agents +
  - oldest_call_start: ταξινομημένο με την τελευταία φοÏά που σε ένα χÏήστη στάλθηκε μία κλήση. Με αποτέλεσμα, ο χÏήστης να λαμβάνει συνολικά το ίδιο αÏιθμό κλήσεων. +
  - oldest_call_finish: ταξινομημένο με την τελευταία φοÏά που ένας χÏήστης τελείωσε μία κλήση. Ο χÏήστης που πεÏιμένει πεÏισσότεÏο λαμβάνει την Ï€Ïώτη κλήση. +
  - overall_user_level: οι διαταγές από το user_level του Ï€ÏάκτοÏα όπως καθοÏίζεται στα vicidial_users παÏουσιάζουν ένα υψηλότεÏο user_level θα λάβουν πεÏισσότεÏες κλήσεις. + +
+
+
+Τοπική ΩÏα Κλήσης - Εδώ, μποÏείτε να οÏίσετε τις ÏŽÏες που θα θέλατε να γίνουν οι κλήσεις. Αυτό ελέγχετε από τον κωδικό πεÏις και Ïυθμίζεται για Daylight Savings εάν είναι εφαÏμόσιμο. + +
+
+
+Φωνητικό ΤαχυδÏομείο - Εάν έχει οÏιστεί, οι κλήσεις που φυσιολογικά θα γινόντουσαν DROP, θα κατευθυνθοÏν σε αυτό το φωνητικό ταχυδÏομείο, ώστε να ακοÏσετε και να αφήσετε ένα μήνυμα. + +
+
+
+Κλήση Εκτός ΧÏόνου - Εάν έχει οÏιστεί, οι κλήσεις που φυσιολογικά θα έκλειναν μετά το χÏόνο που έχει οÏιστεί στο extensions.conf, θα κλείσουν σε αυτόν τον χÏόνο εάν είναι μικÏότεÏος του extensions.conf. Αυτό επιτÏέπει στην γÏήγοÏη αλλαγή των χÏόνων από διακομιστή σε διακομιστή και πεÏιοÏίζοντας τα αποτελέσματα σε μία εκστÏατεία. Εάν έχετε πολλές κλήσεις με Αυτόματους Τηλεφωνητές ή Φωνητικών ΤαχυδÏομείων, μποÏείτε να αλλάξετε αυτή την τιμή Î¼ÎµÏ„Î±Î¾Ï 21-26 και να δείτε αν τα αποτελέσματα είναι καλÏτεÏα. + +
+
+
+ΠÏόθεμα Κλήσης - Αυτό το ο επιτÏέπει την πιο εÏκολη αλλαγή της διαδÏομής της κλήσης να βγει έξω μέσω διαφοÏετικής μεθόδου, χωÏίς να γίνει επαναφόÏτωση στο Asterisk. ΠÏοκαθοÏισμένο είναι το 9 βασισμένο σÏμφωνα με το 91NXXNXXXXXX στο σχέδιο κλήσεων - extensions.conf. + +
+
+
+CallerID ΕκστÏατείας - Αυτό το πεδίο επιτÏέπει την αποστολεί ενός Ï€ÏοσαÏμοσμένου callerid αÏÎ¹Î¸Î¼Î¿Ï ÏƒÏ„Î¹Ï‚ εξεÏχόμενες κλήσεις. Αυτός είναι ο αÏιθμός που θα εμφανιστεί στο callerid του Ï€Ïοσώπου που καλείται. Το Ï€ÏοκαθοÏισμένο είναι ΑΓÎΩΣΤΟ. Αυτή η επιλογή είναι διαθέσιμη μόνο εάν χÏησιμοποιείται PRIs - ISDN T1s ή E1s - που έχουν Ï€ÏοσαÏμοσμένο callerid χαÏακτηÏιστικό ενεÏγοποιημένο. Αυτό το χαÏακτηÏιστικό μποÏεί να δουλεÏει και με IAX2 trunks εξαÏτώμενο με το τι επιτÏέπει ο παÏοχέας. Το Ï€ÏοσαÏμοσμένο callerID εφαÏμόζεται μόνο σε κλήσεις που τοποθετήθηκαν απευθείας για την εκστÏατεία VICIDIAL, οποιαδήποτε κλήση με 3 μέÏη ή μεταφοÏές δεν θα το στείλουν. + +
+
+
+Τηλ.ΣÏνδεση ΕκστÏατείας VDAD - Αυτό το πεδίο επιτÏέπει γι μία Ï€ÏοσαÏμόσιμη VDAD εσωτ.σÏνδεση μεταφοÏάς. Αυτό σας επιτÏέπει να χÏησιμοποιήσετε διαφοÏετικές διαδικασίες VDADtransfer.agi, σÏμφωνα με την εκστÏατεία. Η Ï€ÏοκαθοÏισμένη AGI μεταφοÏά - εσωτ.σÏνδ. 8365 agi VDADtransfer.agi - στέλνει αμέσως τις κλήσεις στον χÏήστη, μόλις το σηκώσουν. Ενα Ï€Ïόσθετο AGI παÏάεα πολιτικής έÏευνας συμπεÏιλαμβάνεται - 8366 agi - VDADtransferSURVEY.agi - όπου παίζει ένα μήνυμα στο κληθέν Ï€Ïόσωπο και επιτÏέπει να κάνουν επιλογές με τα πλήκτÏα. + +
+
+
+Επέκταση εκστÏατείας REC - αυτός ο τομέας επιτÏέπει μια επέκταση καταγÏαφής συνήθειας που χÏησιμοποιείται με VICIDIAL. Αυτό επιτÏέπει σε σας για να χÏησιμοποιήσει τις διαφοÏετικές επεκτάσεις ανάλογα με πόσο καιÏÏŒ Ï€Î¿Î»Ï Î¸Î­Î»ÎµÏ„Îµ να επιτÏέψετε μια μέγιστη καταγÏαφή και ποιος Ï„Ïπος κωδικοποιητή-αποκωδικοποιητή εσείς θέλει να καταγÏάψει μέσα. Η Ï€Ïοεπιλογή είναι 8309 για τα οποία εάν ακολουθήσετε τα παÏαδείγματα SCRATCH_INSTALL θα καταγÏάψουν με το σχήμα WAV μέχÏι μια ÏŽÏα. Μια άλλη επιλογή που πεÏιλαμβάνεται στα παÏαδείγματα είναι 8310 που θα καταγÏάψουν με το σχήμα GSM για μέχÏι μια ÏŽÏα. + +
+
+
+ΚαταγÏαφή εκστÏατείας - αυτές οι επιλογές επιτÏέπουν σε σας για να επιλέξουν ποιο επίπεδο καταγÏαφής επιτÏέπεται σε αυτήν την εκστÏατεία. Δεν θα θέσει εκτός λειτουÏγίας ΠΟΤΕ την καταγÏαφή στον πελάτη. ONDEMAND είναι η Ï€Ïοεπιλογή και επιτÏέπει στον Ï€ÏάκτοÏα για να αÏχίσει και να σταματήσει όπως απαιτείται. ALLCALLS θα αÏχίσει την καταγÏαφή στον πελάτη όποτε μια κλήση στέλνεται σε έναν Ï€ÏάκτοÏα. + +
+
+
+Όνομα αÏχείου εκστÏατείας REC - αυτός ο τομέας επιτÏέπει σε σας για να Ï€ÏοσαÏμόσει το όνομα της καταγÏαφής όταν η καταγÏαφή εκστÏατείας είναι ONDEMAND ή ALLCALLS. Οι μεταβλητές είναι ΠΡΑΚΤΟΡΑΣ EPOCH FULLDATE TINYDATE ΕΚΣΤΡΑΤΕΙΑΣ CUSTPHONE. Η Ï€Ïοεπιλογή είναι FULLDATE_AGENT και θα εμοίαζε με αυτά τα 20051020-103108_6666. Ένα άλλο παÏάδειγμα είναι CAMPAIGN_TINYDATE_CUSTPHONE που θα εμοίαζε με αυτό το TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+ΧειÏόγÏαφο εκστÏατείας - αυτές οι επιλογές επιτÏέπουν σε σας για να επιλέξουν το χειÏόγÏαφο που θα εμφανιστεί στην οθόνη Ï€ÏακτόÏων για αυτήν την εκστÏατεία. Μην επιλέξτε NONE για να μην παÏουσιάσετε κανένα χειÏόγÏαφο για αυτήν την εκστÏατεία. + +
+
+
+ΠάÏτε την έναÏξη κλήσης - αυτές οι επιλογές επιτÏέπουν σε σας για να επιλέξουν εάν θέλετε την αυτόματος-έναÏξη η σελίδα Ιστός-μοÏφής σε ένα χωÏιστό παÏάθυÏο, αυτόματος-διακόπτης στην ετικέττα ΧΕΙΡΟΓΡΑΦΩΠή δεν κάνετε τίποτα όταν στέλνεται μια κλήση στον Ï€ÏάκτοÏα για αυτήν την εκστÏατεία. + +
+
+
+Μήνυμα αυτόματων τηλεφωνητών - αυτός ο τομέας είναι για την είσοδο σε μια επέκταση στις τυφλές κλήσεις μεταφοÏάς όταν παίÏνει ο Ï€ÏάκτοÏας έναν αυτόματο τηλεφωνητή και χτυπά στο κουμπί μηνυμάτων αυτόματων τηλεφωνητών στο πλαίσιο διασκέψεων μεταφοÏάς. ΠÏέπει να θέσετε αυτό επάνω στον dialplan - extensions.conf - και σιγουÏεÏεστε ότι παίζει ένα ακουστικό αÏχείο κατόπιν κλείνει το τηλέφωνο. + +
+
+
+AMD στέλνει στο VM - αυτές οι επιλογές επιτÏέπουν σε σας για να καθοÏίσουν εάν ένα μήνυμα αφήνεται σε έναν αυτόματο τηλεφωνητή όταν ανιχνεÏεται ότι η κλήση θα διαβιβαστεί αμέσως στην επέκταση απαντώ-μηχανή-μηνυμάτων εάν AMD είναι ενεÏγό και καθοÏίζεται ότι η κλήση είναι ένας αυτόματος τηλεφωνητής. + +
+
+
+ΞφεÏ- Conf DTMF - αυτοί οι τέσσεÏις τομείς επιτÏέπουν σας να έχουν δÏο σÏνολα διάσκεψης μεταφοÏάς και DTMF Ï€Ïοετοιμάζει. Όταν η κλήση ή η εκστÏατεία φοÏτώνεται, το χειÏόγÏαφο vicidial.php θα παÏουσιάσει δÏο κουμπιά στο πλαίσιο μεταφοÏά-διασκέψεων και αυτόματος-θα εποικήσει τον αÏιθμός-ΠΊÎΑΚΑ και στείλετε -στέλνω-δτμφ τους τομείς όταν πιέζεται. + + + +



+ +VICIDIAL_LISTS ΠΙÎΑΚΑΣ

+
+
+ID Λίστας - Αυτό είναι το αÏιθμητικό όνομα της λίστας, δεν μποÏεί να διοÏθωθεί μετά από την αÏχική παÏάδοση, Ï€Ïέπει να πεÏιέχει μόνο αÏιθμοÏÏ‚ και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες. + +
+
+
+Ονομα Λίστας - Αυτή είναι η πεÏιγÏαφή της λίστας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏες. + +
+
+
+ΕκστÏατεία - Αυτή είναι η εκστÏατεία όπου ανήκει η λίστα. Μία λίστα μποÏεί μόνο να κληθεί από μία εκστÏατεία κάθε φοÏά. + +
+
+
+ΕνεÏγοποίηση - Αυτό οÏίζει κατά πόσον η λίστα Ï€Ïόκειται να κληθεί ή όχι. + +
+
+
+ΕπαναφοÏά Κατάστασης-Κλήσης-Καθοδήγησης για την λίστα - Αυτό επαναφέÏει τις καθοδηγήσεις σε αυτή την λίστα στο Πγια \"μη κληθέντα από την τελευταία επαναφοÏά\" και σημαίνει ότι για οποιαδήποτε καθοδήγηση μποÏεί να γίνει κλήση εάν είναι η σωστή κατάσταση, όπως οÏίσθηκε στην οθόνη της εκστÏατείας. + + +



+ +VICIDIAL_INBOUND_GROUPS ΠΙÎΑΚΑΣ

+
+
+ID Ομάδας - Αυτό είναι το σÏντομο όνομα της εισεÏχόμενης ομάδας, δεν μποÏεί να διοÏθωθεί μετά από την αÏχική παÏάδοση, δεν μποÏεί να πεÏιέχει κενά και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20χαÏακτήÏες. + +
+
+
+Ονομα Ομάδας - Αυτή είναι η πεÏιγÏαφή της ομάδας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 30 χαÏακτήÏες. Δεν μποÏεί να συμπεÏιλαμβάνει παÏλες, συν ή κενά . + +
+
+
+ΧÏώμα Ομάδας - Αυτό είναι το χÏώμα που εμφανίζεται στην VICIDIAL εφαÏμογή όταν η κλήση έÏχεται σε αυτή την ομάδα. ΠÏέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 7 χαÏακτήÏες. Εάν αυτό είναι οÏισμένο ως hex , θα Ï€Ïέπει να τοποθετήσετε ένα # στην αÏχή του κειμένου ή το VICIDIAL δεν θα δουλεÏει σωστά. + +
+
+
+ΕνεÏγοποίηση - Αυτό καθοÏίζει κατά πόσον αυτή η ομάδα εμφανίζεται στο κουτί επιλογής όταν ένας χÏήστης συνδέεται. + +
+
+
+Ιστοσελίδα - Αυτή είναι η Ï€ÏοσαÏμοσμένη διεÏθυνση που θα σας κατευθÏνει για κλήσεις που έÏχονται σε αυ την ομάδα. + +
+
+
+Φωνητικό ΤαχυδÏομείο - Εάν οÏίζεται, αυτό είναι το πεÏιεχόμενο Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου όπου οι κλήσεις θα πηγαίνουν, αντί να γίνονται dropped εάν δεν υπάÏχουν διαθέσιμοι χÏήστες μετά τον χÏόνο αναμονής. + +
+
+
+Επόμενη Κλήση ΧÏήστη - Αυτό Ï€ÏοσδιοÏίζει ποιος χÏήστης λαμβάνει την επόμενη κλήση που είναι διαθέσιμη: +
  - random: ταξινομημένο με τυχαία τιμή ενημέÏωσης στον πίνακα vicidial_live_agents +
  - oldest_call_start: ταξινομημένο με την τελευταία φοÏά που σε ένα χÏήστη στάλθηκε μία κλήση. Με αποτέλεσμα, ο χÏήστης να λαμβάνει συνολικά το ίδιο αÏιθμό κλήσεων. +
  - oldest_call_finish: ταξινομημένο με την τελευταία φοÏά που ένας χÏήστης τελείωσε μία κλήση. Ο χÏήστης που πεÏιμένει πεÏισσότεÏο λαμβάνει την Ï€Ïώτη κλήση. +
  - overall_user_level: οι διαταγές από το user_level του Ï€ÏάκτοÏα όπως καθοÏίζεται στα vicidial_users παÏουσιάζουν ένα υψηλότεÏο user_level θα λάβουν πεÏισσότεÏες κλήσεις. + +
+
+
+Οθόνη ΜπÏÎ¿ÏƒÏ„Î¹Î½Î¿Ï - Αυτό το πεδίο καθοÏίζει κατά πόσον στον VICIDIAL χόμενος χÏήστης θα εμφανίζεται το όνομα του μπÏÎ¿ÏƒÏ„Î¹Î½Î¿Ï - εάν υπάÏχει κάποιο - στο πεδίο κατάστασης όταν η κλήση έÏχεται στον χÏήστη. + +
+
+
+ΧειÏόγÏαφο εκστÏατείας - αυτές οι επιλογές επιτÏέπουν σε σας για να επιλέξουν το χειÏόγÏαφο που θα εμφανιστεί στην οθόνη Ï€ÏακτόÏων για αυτήν την εκστÏατεία. Μην επιλέξτε NONE για να μην παÏουσιάσετε κανένα χειÏόγÏαφο για αυτήν την εκστÏατεία. + +
+
+
+ΠάÏτε την έναÏξη κλήσης - αυτές οι επιλογές επιτÏέπουν σε σας για να επιλέξουν εάν θέλετε την αυτόματος-έναÏξη η σελίδα Ιστός-μοÏφής σε ένα χωÏιστό παÏάθυÏο, αυτόματος-διακόπτης στην ετικέττα ΧΕΙΡΟΓΡΑΦΩΠή δεν κάνετε τίποτα όταν στέλνεται μια κλήση στον Ï€ÏάκτοÏα για αυτήν την εκστÏατεία. + +
+
+
+ΞφεÏ- Conf DTMF - αυτοί οι τέσσεÏις τομείς επιτÏέπουν σας να έχουν δÏο σÏνολα διάσκεψης μεταφοÏάς και DTMF Ï€Ïοετοιμάζει. Όταν η κλήση ή η εκστÏατεία φοÏτώνεται, το χειÏόγÏαφο vicidial.php θα παÏουσιάσει δÏο κουμπιά στο πλαίσιο μεταφοÏά-διασκέψεων και αυτόματος-θα εποικήσει τον αÏιθμός-ΠΊÎΑΚΑ και στείλετε -στέλνω-δτμφ τους τομείς όταν πιέζεται. + + + + +



+ +VICIDIAL_REMOTE_AGENTS ΠΙÎΑΚΑΣ

+
+
+ΑÏχή ID ΧÏήστη - Αυτό είναι η αÏχή του ID ΧÏήστη που χÏησιμοποιείται όταν οι καταχωÏήσεις των απομακÏυσμένων χÏηστών παÏεμβάλλονται στο σÏστημα. Εάν ο αÏιθμός των γÏαμμών είναι μεγαλÏτεÏος από 1, αυτός ο αÏιθμός αυξάνει κατά ένα μέχÏι κάθε γÏαμμή να έχει μία καταχώÏηση. Επιβεβαιώστε, ότι δημιουÏγήσατε ένα νέο VICIDIAL λογαÏιασμό η με επίπεδο χÏήσης 4 ή μεγαλÏτεÏο, εάν θέλετε να μποÏεί να χÏησιμοποιήσει την σελίδα vdremote για απομακÏυσμένη Ï€Ïόσβαση του λογαÏÎ¹Î±ÏƒÎ¼Î¿Ï Ï„Î¿Ï…. + +
+
+
+ΑÏιθμός ΓÏαμμών - Αυτό οÏίζει πόσες καταχωÏήσεις απομακÏυσμένων χÏηστών το σÏστημα δημιουÏ, και καθοÏίζει πόσες γÏαμμές μποÏεί με ασφάλεια να στείλει στον αÏιθμό παÏακάτω. + +
+
+
+IP Διακομιστή - Μία καταχώÏηση απομακÏυσμένου χÏήστη είναι μόνο καλό για ένα συγκεκÏιμένο διακομιστή, εδώ είναι που επιλέ τον διακομιστή που ανήκει. + +
+
+
+ΕξωτεÏική Τηλ.ΣÏνδεση - Αυτός είναι ο αÏιθμός που θέλετε οι κλήσεις να Ï€ÏοωθοÏνται. Επιβεβαιώστε ότι είναι ένας πλήÏης αÏιθμός από το σχέδιο κλήσεων και εάν θέλετε ένα 9 στην αÏχή το βάζετε εδώ. Κάντε μία δοκιμή καλώντας αυτόν τον αÏιθμό από ένα τηλέφωνο του συστήματος. + +
+
+
+Κατάσταση - Εδώ μποÏείτε να θέσετε τον απομακÏυσμένο χÏήστη σε ενεÏγό και μη ενεÏγό. Μόλις ο χÏήστης γίνει ενεÏγός το σÏστημα μποÏεί να στείλει κλήσεις σε αυτόν. ΜποÏεί να διαÏκέσει μέχÏι 30 δευτεÏόλεπτα μετά την αλλαγή της κατάστασης σε μη ενεÏγός, ώστε να σταματήσει να δέχεται κς. + +
+
+
+ΕκστÏατεία - Εδώ μπο να επιλέξετε την εκστÏατεία όπου οι απομακÏυσμένοι χÏήστες θα συνδεθοÏν. Για εισεÏχόμενες Ï€Ïέπει να χÏησιμοποιηθεί η εκστÏατεία CLOSER και επιλέξτε τις εισεÏχόμενες εκστÏατείες παÏακάτω, από που θέλετε να λαμβάνεται τις κλήσεις. + +
+
+
+ΕισεÏχόμενες Ομάδες - Εδώ μποÏείτε να επιλέξετε τις εισεÏχόμενες ομάδες που θέλετε να λαμβάνουν τις κλήσεις , εάν έχετε επιλέξει την εκστÏατεία CLOSER. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+Οι λίστες της εκστÏατείας παÏουσιάζονται εδώ, και εάν είναι ενεÏγές δηαι με Î¥ ή Πκαι μποÏείτε να πάτε στην οθόνη λίστας με το να πατήσετε στο ID λίστας, στην Ï€Ïώτη στήλη. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES ΠΙÎΑΚΑΣ

+
+
+Με την χÏήση Ï€ÏοσαÏμοσμένων καταστάσεων εκστÏατείας, μποÏείτε να έχετε καταστάσεις μόνο για συγκεκÏιμένες εκστÏατείες. Η κατάσταση Ï€Ïέπει να είναι 1-8 χαÏακτήÏες, η πεÏιγÏαφή 2-30 χαÏακτήÏες και Επιλέξιμα καθοÏίζεται αν εμφανίζεται στο VICIDIAL ως τεÏματισμός. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS ΠΙÎΑΚΑΣ

+
+
+Με την χÏήση Ï€ÏοσαÏμοσμένων κλειδιών εκστÏατείας, οι χÏήστες που χÏησιμοποιοÏν την εφαÏμογή vicidial μποÏοÏν να κλείσουν και να τεÏματίσουν την κλήση, με ένα μόνο πάτημα πλήκτÏου. + + + + + +



+ +VICIDIAL_USER_GROUPS ΠΙÎΑΚΑΣ

+
+
+Ομάδα ΧÏήστη - Αυτό είναι το σÏντομο όνομα της Vicidial ομάδας χÏήστη, Ï€Ïοσπαθήστε να μην χÏησιμοποιήσετε κενά ή στίξεις για αυτό το πεδίο. Από 2 μέχÏι 20 χαÏακτήÏες. + +
+
+
+Ονομα Ομάδας- Αυτή είναι η πεÏιγÏαφή της vicidial ομάδας χÏήστη μέχÏι 40 χαÏακτήÏες. + + + + + +



+ +VICIDIAL_SCRIPTS ΠΙÎΑΚΑΣ

+
+
+Ταυτότητα χειÏογÏάφων - αυτό είναι το σÏντομο όνομα ενός χειÏογÏάφου Vicidial. Αυτό Ï€Ïέπει να είναι ένα μοναδικό Ï€ÏοσδιοÏιστικό. ΠÏοσπαθήστε να μην χÏησιμοποιήσετε οποιαδήποτε διαστήματα ή στίξη για ανώτατους 10 χαÏακτήÏες αυτών των τομέων, ελάχιστο 2 χαÏακτήÏων. + +
+
+Όνομα χειÏογÏάφων - αυτό είναι ο τίτλος ενός χειÏογÏάφου Vicidial. Αυτό είναι μια σÏντομη πεÏίληψη των ανώτατων 50 χαÏακτήÏων χειÏογÏάφων, ελάχιστο 2 χαÏακτήÏων. Δεν Ï€Ïέπει να υπάÏξουν καμία διάστημα ή στίξη οποιουδήποτε είδους στον τομέα theis. + +
+
+Τα σχόλια χειÏογÏάφων - αυτό είναι όπου μποÏείτε να τοποθετήσετε τα σχόλια για ένα χειÏόγÏαφο Vicidial όπως - άλλαξαν στην ελεÏθεÏη βελτίωση στις 23 του ΣεπτεμβÏίου -. ανώτατοι 255 χαÏακτήÏες, ελάχιστο 2 χαÏακτήÏων. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today? + +
+
+
+ΕνεÏγός - αυτό καθοÏίζει εάν αυτό το χειÏόγÏαφο μποÏεί να επιλεχτεί για να χÏησιμοποιηθεί από μια εκστÏατεία. + + + + + +



+ +VICIDIAL ΛΕΙΤΟΥΡΓΙΑ ΦΟΡΤΩΣΗΣ ΛΙΣΤΑΣ

+
+
+Ο VICIDIAL φοÏτωτής καθοδηγητών είναι απλά σχεδιασμένος, ώστε να παίÏνει ένα αÏχείο - μέχÏι 8ΜΒ - που είναι διαχωÏισμένο με tab ή pipe και να το φοÏτώνει στον πίνακα vicidial_list. ΥπάÏχει επίσης ένας νέος βήτα φοÏτωτής μολÏβδου έκδοσης έξοχος που επιτÏέπει τον τομέα επιλέγοντας και TXT - σαφές κείμενο, CSV - κόμμα χώÏισε τις τιμές και XLS - σχήματα αÏχείων Excel. Ο φοÏτωτής δεν κάνει εξακÏίβωση δεδομένων ή έλεγχο σε διπλές καταχωÏήσεις, το οποί είναι κάτι που Ï€Ïέπει να κάνετε Ï€Ïιν την φόÏτωση. Επίσης, διευκÏινίστε ότι έχετε δημιουÏγήσει την λίστα όπου οι καθοδηγητές θα είναι από κάτω, ώστε να τους χÏησιμοποιήσετε.ΥπάÏχει επίσης το θέμα με τις ζώνες κωδικοποίησης χÏόνου των καθοδηγητών. ΜποÏεί να θέλετε να αυξήσετε την συχνότητα όπου το ADMIN_adjust_GMTnow_on_leads.pl Ï„Ïέχει στον cron, ώστε οποιαδήποτε φόÏτωση καθοδηγητών να κωδικοποιείται πιο γÏήγοÏα. Εδώ είναι μία λίστα από πεδία στην Ï€Ïέπουσα ταξινόμηση για τα αÏχεία καθοδήγησης.: +
    +
  1. Κωδικός ÎšÎ±Î¸Î¿Î´Î·Î³Î·Ï„Î¿Ï Î ÏÎ¿Î¼Î·Î¸ÎµÏ…Ï„Î¿Ï +
  2. Πηγαίος Κώδικας - εσωτεÏική χÏήση μόνο από διαχειÏιστές και DBAs +
  3. ID λίστας - ο αÏιθμός λίστας που οι καθοδηγητές θα παÏουσιαστοÏν κάτω από +
  4. Κωδικός τηλεφώνου - το Ï€Ïόθεμα του Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï (1 για ΗΠΑ, 01144 για Î’Ïετανία κλπ) +
  5. Ο αÏιθμός τηλεφώνου - Ï€Ïέπει να είναι τουλάχιστον 8 ψηφία +
  6. Τίτλος - ο τίτλος του πελάτη (κος. κα. κλπ) +
  7. Ονομα +
  8. Μεσαίο ΑÏχικό +
  9. Επίθετο +
  10. 1 ΓÏαμμή ΔιεÏθυνσης +
  11. 2 ΓÏαμμή ΔιεÏθυνσης +
  12. 3 ΓÏαμμή ΔιεÏθυνσης +
  13. Πόλη +
  14. ΚÏάτος - πεÏιοÏισμός σε 2 χαÏακτήÏες +
  15. ΕπαÏχία +
  16. Ταχ.Κωδ. +
  17. ΧώÏα +
  18. ΦÏλον +
  19. ΗμεÏ. Γέννησης +
  20. Εναλ. ΑÏιθμός Τηλ. +
  21. ΔιεÏθυνση ΗλεκτÏ.ΤαχυδÏομείου +
  22. ΦÏάση Ασφαλείας +
  23. Σχόλια +
+ +
ΣΗΜΕΙΩΣΕΙΣ: Η λειτουÏγία φοÏτωτών μολÏβδου Excel επιτÏέπεται από μια σειÏά χειÏογÏάφων perl και Ï€Ïέπει να έχει κατάλληλα διαμοÏφωμένη/ένα αÏχείο home/cron/AST_SERVER_conf.pl σε Î¹ÏƒÏ‡Ï ÏƒÏ„Î¿Î½ κεντÏικό υπολογιστή δικτÏου. Επίσης, οι ενότητες ζευγών perl Ï€Ïέπει να φοÏτωθοÏν για το για να εÏγαστοÏν επίσης - ολε- Storage_Lite και υπολογισμός με λογιστικό φÏλλο (spreadsheet)- ParseExcel. ΜποÏείτε να ελέγξετε για τα λάθη χÏόνου εκτέλεσης σε αυτοί με την εξέταση το αÏχείο apache σας error_log. + +







+







+ΤΕΛΟΣ +
+\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "ΧειÏόγÏαφο Ï€Ïόβλεψης: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + + +?> + + + + +\n"; +echo "English \n";echo "Español \n";echo "Ελληνικά \n";?> +
+ + + + + + + +
  VICIDIAL ΔΙΑΧ - ΑΠΟΣΥÎΔΕΣΗ  
  ΛΙΣΤΑ ΧΡΗΣΤΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΗΣΤΗ | ΑÎΑΖΗΤΗΣΗ ΧΡΗΣΤΗ |               |ΠΡΟΣΘΗΚΗ ΟΜΑΔΑΣ ΧΡΗΣΤΗ | ΛΙΣΤΑ ΟΜΑΔΩΠΧΡΗΣΤΗ
  ΠΡΟΣΘΗΚΗ ΕΚΣΤΡΑΤΕΙΑΣ | ΛΙΣΤΑΣ ΕΚΣΤΡΑΤΕΙΩΠ|              | ΕΜΦΑÎΙΣΗ ΛΙΣΤΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΛΙΣΤΑΣ |               | ΦΌΡΤΙΣΗ ÎΕΩΠΚΑΘΟΔΗΓΗΤΩÎ
  ΕΜΦΑÎΙΣΗ ΕΙΣΕΡΧΟΜΕÎΩΠΟΜΑΔΩΠ| ΠΡΟΣΘΗΚΗ ÎΈΑΣ ΕΙΣΕΡΜΟΜΕÎΗΣ ΟΜΑΔΑΣ |               | ΕΜΦΑÎΙΣΗ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩΠ| ΠΡΟΣΘΗΚΗ ÎΕΩΠΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩÎ
  STATS AND REPORTS               | ΠΡΟΣΘΕΣΤΕ ΤΟ ΧΕΙΡΟΓΡΑΦΟ | ΧΕΙΡΟΓΡΑΦΑ ΑΠΟΨΗΣ |             | ΑÎΑΖΗΤΗΣΗ ΚΑΘΟΔΗΓΗΣΗΣ | ΩÏιαία Ομάδα
+"; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΗΣΤΗ
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "$NWB#vicidial_users-user_group$NWE\n"; +echo "\n"; +echo "
ΑÏιθμός ΧÏήστη: $NWB#vicidial_users-user$NWE
Κωδικός:$NWB#vicidial_users-pass$NWE
ΠλήÏες Ονομα: $NWB#vicidial_users-full_name$NWE
Επίπεδο ΧÏήστη: $NWB#vicidial_users-user_level$NWE
Ομάδα ΧÏήστη:
Τηλεφωνική σÏνδεση: $NWB#vicidial_users-phone_login$NWE
Τηλεφωνικός κωδικός Ï€Ïόσβασης: $NWB#vicidial_users-phone_pass$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΕνεÏγός:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: $NWB#vicidial_campaigns-park_ext$NWE
Ονομα ΑÏχείου Στάθμευσης: $NWB#vicidial_campaigns-park_file_name$NWE
Ιστο-σελίδα: $NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω Τους Closers: $NWB#vicidial_campaigns-allow_closers$NWE
ΕΠΙΠΕΔΟ Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Επόμενη Κλήση ΧÏήστη: $NWB#vicidial_campaigns-next_agent_call$NWE
ΧÏόνος Τοπικής Κλήσης: $NWB#vicidial_campaigns-local_call_time$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_campaigns-voicemail_ext$NWE
ΧειÏόγÏαφο: $NWB#vicidial_campaigns-campaign_script$NWE
ΠάÏτε την έναÏξη κλήσης: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Λίστας: (μόνο αÏιθμοί)$NWB#vicidial_lists-list_id$NWE
Ονομα Λίστας: $NWB#vicidial_lists-list_name$NWE
ΕκστÏατείας:$NWB#vicidial_lists-campaign_id$NWE
ΕνεÏγός:$NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΈΑΣ ΕΙΣΕΡΧΟΜΕÎΗΣ ΟΜΑΔΑΣ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Ομάδας: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Ονομα Ομάδας: $NWB#vicidial_inbound_groups-group_name$NWE
ΧÏώμα Ομάδας: $NWB#vicidial_inbound_groups-group_color$NWE
ΕνεÏγός:$NWB#vicidial_inbound_groups-active$NWE
Ιστο-σελίδα: $NWB#vicidial_inbound_groups-web_form_address$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Επόμενη Κλήση ΧÏήστη: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Οθόνη ΜπÏοστινοÏ: $NWB#vicidial_inbound_groups-fronter_display$NWE
ΧειÏόγÏαφο: $NWB#vicidial_inbound_groups-ingroup_script$NWE
ΠάÏτε την έναÏξη κλήσης: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΩΠΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩÎ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκίνημα: (μόνο αÏιθμοί, incremented)$NWB#vicidial_remote_agents-user_start$NWE
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Διακομιστή: $NWB#vicidial_remote_agents-server_ip$NWE
ΕξωτεÏική Τηλ. ΣÏνδεση: ()$NWB#vicidial_remote_agents-conf_exten$NWE
Κατάσταση:$NWB#vicidial_remote_agents-status$NWE
ΕκστÏατείας:$NWB#vicidial_remote_agents-campaign_id$NWE
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΑ ΟΜΑΔΑ ΧΡΗΣΤΩÎ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ομάδα: (όχι κενά ή στίξη)$NWB#vicidial_user_groups-user_group$NWE
ΠεÏιγÏαφή: (πεÏιγÏαφή ομάδας)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ +echo ""; + +echo "
ADD NEW SCRIPT\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Script ID: (όχι κενά ή στίξη)$NWB#vicidial_scripts-script_id$NWE
Script Name: (τίτλος του χειÏογÏάφου)$NWB#vicidial_scripts-script_name$NWE
Script Σχόλια: $NWB#vicidial_scripts-script_comments$NWE
ΕνεÏγός:$NWB#vicidial_scripts-active$NWE
Script Text: $NWB#vicidial_scripts-script_text$NWE
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένας χÏήστης με αυτό τον αÏιθμό\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το id χÏήστη Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
το πλήÏες όνομα και κωδικός Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΠΡΟΣΤΕΘΗΚΕ: $user\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');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία εκστÏατεία με αυτό το ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 6 και 40 χαÏακτήÏες\n"; + } + else + { + echo "
ΚΣΤΡΑΤΕΙΑ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch')|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη κατάσταση-εκστÏατείας με αυτό το όνομα\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία καθολική-κατάσταση με αυτό το όνομα\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 8 χαÏακτήÏÏες\n"; + echo "
το όνομα της κατάστασης Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 30 χαÏακτήÏÏες\n"; + } + else + { + echo "
ΚΑΤΑΣΤΑΣΗ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } + } +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΤΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένα κλειδί-εκστÏατείας με αυτό το κλειδί\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
ΤΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το κλειδί Ï€Ïέπει να είναι ένας χαÏακτηÏάς Î¼ÎµÏ„Î±Î¾Ï 1 και 9 \n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 8 χαÏακτήÏÏες\n"; + } + else + { + echo "
ΚΛΕΙΔΙ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ HOTKEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΛΙΣΤΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία λίστα με αυτό το ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
Η ΛΙΣΤΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID λίστας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
Το όνομα λίστας Ï€Ïέπει να είναι 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΛΙΣΤΑ ΠΡΟΣΤΕΘΗΚΕ: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία ομάδα με αυτό το ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID ομάδας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏες ' -+'.\n"; + echo "
Το όνομα και χÏώμα ομάδας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΟΜΑΔΑ ΠΡΟΣΤΕΘΗΚΕ: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch'|\n"); + fclose($fp); + } + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΔΕΠΠΡΟΣΤΕΘΗΚΑΠ- υπάÏχει ήδη καταχώÏηση απομακÏυσμένων χÏηστών που ξεκινάει με αυτό το ID χÏήστη\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
ΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΔΕΠΠΡΟΣΤΕΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID χÏήστη και η εξωτεÏική εσωτ.σÏνδεση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΠΡΟΣΤΕΘΗΚΑÎ: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΔΕΠΠΡΟΣΤΕΘΗΚΕ Η ΟΜΑΔΑ ΧΡΗΣΤΗ - υπάÏχει ήδη μία καταχώÏηση ομάδας χÏήστη με αυτό το όνομα\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Η ομάδα και η πεÏιγÏαφή Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER ΟΜΑΔΑ ΠΡΟΣΤΕΘΗΚΕ: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΗΣΤΗ GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΧΕΙΡΟΓΡΑΦΟ ΠΡΟΣΤΙΘΕΜΕÎΟ - υπάÏχει ήδη μια είσοδος χειÏογÏάφων με αυτό το όνομα\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ΧΕΙΡΟΓΡΑΦΟ ΠΡΟΣΤΙΘΕΜΕÎΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Το όνομα, η πεÏιγÏαφή και το κείμενο χειÏογÏάφων Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες στο μήκος\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΧΕΙΡΟΓΡΑΦΟ ΠΡΟΣΤΙΘΕΜΕÎΟ: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|'$script_id','$script_name','$script_comments','$script_text','$active'|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Ο κωδικός και το πλήÏες όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες το κάθε ένα\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ - ADMIN: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|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' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Ο κωδικός και το πλήÏες όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες το κάθε ένα\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 6 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΣΤΡΑΤΕΙΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΘΟΘΗΓΗΤΗ ΕΚΣΤΡΑΤΕΙΑΣ HOPPER\n"; + echo "
- Αναμονή 1 Î»ÎµÏ€Ï„Î¿Ï Ï€Ïιν την κλήση του επόμενου αÏιθμοÏ\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + echo "
η κατάσταση της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 1 χαÏακτήÏας\n"; + } + else + { + echo "
ΔΙΑΓΡΑΦΗΚΕ Η ΠΡΟΣΑΡΜΟΣΜΕÎΗ ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
ΤΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + echo "
η κατάσταση της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 1 χαÏακτήÏας\n"; + echo "
το κλειδί της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 1 χαÏακτήÏας\n"; + } + else + { + echo "
ΔΙΑΦΡΑΦΗΚΕ ΤΟ ΠΡΟΣΑΡΜΟΣΜΕÎΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 6 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΣΤΡΑΤΕΙΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΘΟΘΗΓΗΤΗ ΕΚΣΤΡΑΤΕΙΑΣ HOPPER\n"; + echo "
- Αναμονή 1 Î»ÎµÏ€Ï„Î¿Ï Ï€Ïιν την κλήση του επόμενου αÏιθμοÏ\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
Η ΛΙΣΤΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
η λίστα Ï€Ïέπει να είναι τουλαχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΛΙΣΤΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΤΑΣΤΑΣΗΣ ΚΛΗΣΗΣ ΛΙΣΤΑΣ\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + } + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
Η ΟΜΑΔΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα και χÏώμα ομάδας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΟΜΑΔΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id'|\n"); + fclose($fp); + } + } + +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID του χÏήστη και η εξωτεÏική εσωτ.σÏνδεση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΤΡΟΠΟΠΟΙΗΘΗΚΑÎ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER Η ΟΜΑΔΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Η ομάδα και η πεÏιγÏαφή Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER ΟΜΑΔΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + } + } + +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ΧΕΙΡΟΓΡΑΦΟ ΤΡΟΠΟΠΟΙΗΜΕÎΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Το όνομα, η πεÏιγÏαφή και το κείμενο χειÏογÏάφων Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες στο μήκος\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΧΕΙΡΟΓΡΑΦΟ ΤΡΟΠΟΠΟΙΗΜΕÎΟ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id'|\n"); + fclose($fp); + } + } + +$ADD=3111111; # go to script modification form below +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
ΧΡΗΣΤΗΣ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΗΣΤΩÎ: $user\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το χÏήστη $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε την εκστÏατεία $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
ΠΡΑΚΤΟΡΕΣ ΠΟΥ ΔΕΠΚΑΤΑΓΡΑΦΟÎΤΑΙ ΑΠΟ ΤΗΠΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΑΠΟΣΥÎΔΕΣΗΣ ΠΡΑΚΤΟΡΩÎ: $campaign_id\n"; + echo "

Χτυπήστε εδώ για να καταγÏάψετε όλους τους Ï€ÏάκτοÏες από $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΚΑΤΑΛΟΓΟΣ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΚΑΤΑΛΟΓΩÎ: $list_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε τον κατάλογο και τους όλους μολÏβδους του $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
ΣΤΗÎ-ΟΜΑΔΑ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
ΣΤΗÎ-ΟΜΑΔΑ ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ: $group_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε την-ΟΜΑΔΑ $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
ΜΑΚΡΙÎΟΣ ΠΡΑΚΤΟΡΑΣ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
ΜΑΚΡΙÎΗ ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΠΡΑΚΤΟΡΩÎ: $remote_agent_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το μακÏινό Ï€ÏάκτοÏα $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
ΟΜΑΔΑ ΧΡΗΣΤΩΠΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΟΜΑΔΑΣ ΧΡΗΣΤΩÎ: $user_group\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το χÏήστη group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΧΕΙΡΟΓΡΑΦΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΕΙΡΟΓΡΑΦΩÎ: $user_group\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το χειÏόγÏαφο $script_id


\n"; + } + +$ADD='3111111'; # go to user group modification below +} + + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
ΧΡΗΣΤΗΣ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|user='$user'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΧΡΗΣΤΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΕΚΣΤΡΑΤΕΙΑΣ ΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents fro a campaign +###################### + +if ($ADD==62) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
ΠΡΑΚΤΟΡΕΣ ΠΟΥ ΔΕΠΚΑΤΑΓΡΑΦΟÎΤΑΙ ΑΠΟ ΤΗΠΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
ΑΠΟΣΥÎΔΕΣΗ ΠΡΑΚΤΟΡΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='31'; # go to campaign modification below +} +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΚΑΤΑΛΟΓΟΣ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΦΑΙΡΕΣΗ ΤΩΠΜΟΛΥΒΔΩΠΚΑΤΑΛΟΓΩΠΑΠΟ ΤΟΠΠΊÎΑΚΑ VICIDIAL_LIST\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΚΑΤΑΛΟΓΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
ΣΤΗÎ-ΟΜΑΔΑ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
ΣΤΗÎ-ΟΜΑΔΑ ΔΙΑΓΡΑΦΗ ΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
ΜΑΚΡΙÎΟΣ ΠΡΑΚΤΟΡΑΣ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
ΜΑΚΡΙÎΗ ΔΙΑΓΡΑΦΗ ΠΡΑΚΤΟΡΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
ΟΜΑΔΑ ΧΡΗΣΤΩΠΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΟΜΑΔΑΣ ΧΡΗΣΤΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ ΧΕΙΡΟΓΡΑΦΟ - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΧΕΙΡΟΓΡΑΦΩΠΠΟΥ ΟΛΟΚΛΗΡΩÎΕΤΑΙ: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to user group list +} + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + +if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
Δεν έχετε τις άδειες να Ï„Ïοποποιήσετε αυτόν τον χÏήστη: $row[1]\n"; + } +else + { + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΧΡΗΣΤΩÎ: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + {echo "\n";} + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level > 8) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
ΑÏιθμός ΧÏήστη: $row[1]$NWB#vicidial_users-user$NWE
Κωδικός:$NWB#vicidial_users-pass$NWE
ΠλήÏες Ονομα: $NWB#vicidial_users-full_name$NWE
Επίπεδο ΧÏήστη: $NWB#vicidial_users-user_level$NWE
Ομάδα ΧÏήστη: $NWB#vicidial_users-user_group$NWE
Τηλεφωνική σÏνδεση: $NWB#vicidial_users-phone_login$NWE
Τηλεφωνικός κωδικός Ï€Ïόσβασης: $NWB#vicidial_users-phone_pass$NWE
Ο Ï€ÏάκτοÏας επιλέγει Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
HotKeys ενεÏγός: $NWB#vicidial_users-hotkeys_active$NWE
ΔιαγÏάψτε τους χÏήστες: $NWB#vicidial_users-delete_users$NWE
ΔιαγÏάψτε τις ομάδες χÏηστών: $NWB#vicidial_users-delete_user_groups$NWE
ΔιαγÏάψτε τους καταλόγους: $NWB#vicidial_users-delete_lists$NWE
ΔιαγÏάψτε τις εκστÏατείες: $NWB#vicidial_users-delete_campaigns$NWE
ΔιαγÏάψτε τις-ΟΜΑΔΕΣ: $NWB#vicidial_users-delete_ingroups$NWE
ΔιαγÏάψτε τους μακÏινοÏÏ‚ Ï€ÏάκτοÏες: $NWB#vicidial_users-delete_remote_agents$NWE
ΔιαγÏάψτε το χειÏόγÏαφοs: $NWB#vicidial_users-delete_scripts$NWE
Το φοÏτίο οδηγεί: $NWB#vicidial_users-load_leads$NWE
ΛεπτομέÏεια εκστÏατείας: $NWB#vicidial_users-campaign_detail$NWE
ΠÏόσβαση AGC Admin: $NWB#vicidial_users-ast_admin_access$NWE
Το AGC διαγÏάφει τα τηλέφωνα: $NWB#vicidial_users-ast_delete_phones$NWE
ΤÏοποποιήστε τους μολÏβδους: $NWB#vicidial_users-modify_leads$NWE
ΕκστÏατεία Ï€ÏακτόÏων αλλαγής: $NWB#vicidial_users-change_agent_campaign$NWE
ΕισεÏχόμενες Ομάδες: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_users-closer_campaigns$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟΠΤΟΠΧΡΗΣΤΗ\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Πατήστε εδώ για στατιστικά χÏήστη\n"; + echo "

Click here for user CallBack Holds\n"; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΕΚΣΤΡΑΤΕΙΩÎ: $row[0] - Βασική Επισκόπηση | Αναλυτική Επισκόπηση\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
ID ΕκστÏατείας: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΕνεÏγός:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Ιστο-σελίδα: $NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω Τους Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Κατάσταση κλήσης1: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης2: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης3: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης4: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης5: $NWB#vicidial_campaigns-dial_status$NWE
ΣειÏά Λίστας: $NWB#vicidial_campaigns-lead_order$NWE
ΕΠΙΠΕΔΟ Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Αναγκαστική ΕπαναφοÏά του Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Επόμενη Κλήση ΧÏήστη: $NWB#vicidial_campaigns-next_agent_call$NWE
ΧÏόνος Τοπικής Κλήσης: $NWB#vicidial_campaigns-local_call_time$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_campaigns-voicemail_ext$NWE
Κλήση εκτός χÏόνου: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
ΠÏόθεμα Κλήσης: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
CallerID ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_cid$NWE
ΕκστÏατείας VDAD εσωτ.σÏνδεση: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Επέκταση εκστÏατείας REC: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
ΚαταγÏαφή εκστÏατείας: $NWB#vicidial_campaigns-campaign_recording$NWE
Όνομα αÏχείου εκστÏατείας REC: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
ΧειÏόγÏαφο: $NWB#vicidial_campaigns-campaign_script$NWE
ΠάÏτε την έναÏξη κλήσης: $NWB#vicidial_campaigns-get_call_launch$NWE
Μήνυμα αυτόματων τηλεφωνητών: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD στέλνει στο VM: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
ΜεταφοÏά- Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf αÏιθμός 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf αÏιθμός 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
ΛΙΣΤΕΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ID ΛΙΣΤΑΣΟÎΟΜΑ ΛΙΣΤΑΣΕÎΕΡΓΑ
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Αυτή η εκστÏατεία έχει$active_lists ενεÏγές λίστες και$inactive_lists Μη ενεÏγές λίστες

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "Αυτή η εκστÏατεία έχει$active_leads καθοδηγητές που καλοÏντε στις λίστες

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "Αυτή η εκστÏατεία έχει$hopper_leads >καθοδηγητές στον hopper κλήσεων<

\n"; +echo "Πατήστε εδώ για να δείτε ποιοι καθοδηγητές είναι στον hopper τώÏα

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
ΠΡΟΣΑΡΜΟΣΜΕÎΕΣ ΚΑΤΑΣΤΑΣΕΙΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ΚΑΤΑΣΤΑΣΗΠΕΡΙΓΡΑΦΗΕΠΙΛΕΞΙΜΟΔΙΑΓΡΑΦΗ
$rowx[0]$rowx[1]$rowx[2]ΔΙΑΓΡΑΦΗ
\n"; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΠΡΟΣΑΡΜΟΣΜΕÎΗΣ ΚΑΤΑΣΤΑΣΗΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ
\n"; +echo "\n"; +echo "\n"; +echo "Κατάσταση:   \n"; +echo "ΠεÏιγÏαφή:   \n"; +echo "Επιλέξιμο:   \n"; +echo "
\n"; + +echo "

\n"; + + + +echo "
ΠΡΟΣΑΡΜΟΣΜΕÎΑ ΚΛΕΙΔΙΑ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ΚΛΕΙΔΙΚΑΤΑΣΤΑΣΗΠΕΡΙΓΡΑΦΗΔΙΑΓΡΑΦΗ
$rowx[1]$rowx[0]$rowx[2]ΔΙΑΓΡΑΦΗ
\n"; + +echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΠΡΟΣΑΡΜΟΣΜΕÎΟΥ ΚΛΕΙΔΙΟΥ ΕΚΣΤΡΑΤΕΙΑΣ
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Κλειδί:   \n"; +echo "Κατάσταση:   \n"; +echo "
\n"; + +echo "

\n"; + +echo "ΚΑΤΑΓΡΑΨΤΕ ΟΛΟΥΣ ΤΟΥΣ ΠΡΑΚΤΟΡΕΣ ΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ

\n"; + +if ($LOGdelete_campaigns > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n"; + } + +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ($ADD==34) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Βασική Επισκόπηση | Αναλυτική Επισκόπηση
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
ID ΕκστÏατείας: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΕνεÏγός:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Ιστο-σελίδα: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω Τους Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Κατάσταση κλήσης1: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης2: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης3: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης4: $NWB#vicidial_campaigns-dial_status$NWE
Κατάσταση κλήσης5: $NWB#vicidial_campaigns-dial_status$NWE
ΣειÏά Λίστας: $NWB#vicidial_campaigns-lead_order$NWE
ΕΠΙΠΕΔΟ Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Αναγκαστική ΕπαναφοÏά του Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
ΧειÏόγÏαφο: $script_id
ΠάÏτε την έναÏξη κλήσης: $get_call_launch
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + +echo "
\n"; +echo "
ΛΙΣΤΕΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ID ΛΙΣΤΑΣΟÎΟΜΑ ΛΙΣΤΑΣΕÎΕΡΓΑ
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Αυτή η εκστÏατεία έχει$active_lists ενεÏγές λίστες και$inactive_lists Μη ενεÏγές λίστες

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "Αυτή η εκστÏατεία έχει$active_leads καθοδηγητές που καλοÏντε στις λίστες

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "Αυτή η εκστÏατεία έχει$hopper_leads >καθοδηγητές στον hopper κλήσεων<

\n"; +echo "Πατήστε εδώ για να δείτε ποιοι καθοδηγητές είναι στον hopper τώÏα

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + +echo "
\n"; + +echo "ΚΑΤΑΓΡΑΨΤΕ ΟΛΟΥΣ ΤΟΥΣ ΠΡΑΚΤΟΡΕΣ ΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ

\n"; + + +if ($LOGdelete_campaigns > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n"; + } + + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΛΙΣΤΑΣ: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID Λίστας: $row[0]$NWB#vicidial_lists-list_id$NWE
Ονομα Λίστας: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
ΕνεÏγός:$NWB#vicidial_lists-active$NWE
ΕΠΑÎΑΦΟΡΑ ΚΑΤΑΣΤΑΣΗΣ ΚΛΗΣΗΣ ΚΑΘΟΔΗΓΗΣΗΣ ΓΙΑ ΤΗΠΛΙΣΤΑ: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
ΚΑΤΑΣΤΑΣΕΙΣ ΣΤΗΠΛΙΣΤΑ:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[0] == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
ΚΑΤΑΣΤΑΣΗΚΛΗΘΕÎΤΑΜΗ ΚΛΗΘΕÎΤΑ
$CLB$rowx[0]$CLE $rowx[2]
$CLB$rowx[0]$CLE$rowx[2]
ΥΠΟΣΥÎΟΛΑ$leads_in_list_Y$leads_in_list_N
ΣΥÎΟΛΙΚΑ$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
ΖΩÎΕΣ ΩΡΑΣ ΣΤΗΠΛΙΣΤΑ:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
GMT OFFSET (τοπικός χÏόνος)ΚΛΗΘΕÎΤΑΜΗ ΚΛΗΘΕÎΤΑ
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
ΥΠΟΣΥÎΟΛΑ$leads_in_list_Y$leads_in_list_N
ΣΥÎΟΛΙΚΑ$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
ΜΕΤΡΗΣΗ ΚΛΗΣΕΩΠΣΤΗΠΛΙΣΤΑ:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
ΚΑΤΑΣΤΑΣΗ$firstΥΠΟΣΥÎΟΛΟ
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
ΣΥÎΟΛΙΚΑ$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +if ($LOGdelete_lists > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟΠΤΟΠΚΑΤΑΛΟΓΟ\n"; + } + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΟΜΑΔΩÎ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + + +echo "\n"; +echo "
ID Ομάδας: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Ονομα Ομάδας: $NWB#vicidial_inbound_groups-group_name$NWE
ΧÏώμα Ομάδας: $NWB#vicidial_inbound_groups-group_color$NWE
ΕνεÏγός:$NWB#vicidial_inbound_groups-active$NWE
Ιστο-σελίδα: $NWB#vicidial_inbound_groups-web_form_address$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Επόμενη Κλήση ΧÏήστη: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Οθόνη ΜπÏοστινοÏ: $NWB#vicidial_inbound_groups-fronter_display$NWE
ΧειÏόγÏαφο: $NWB#vicidial_inbound_groups-ingroup_script$NWE
ΠάÏτε την έναÏξη κλήσης: $NWB#vicidial_inbound_groups-get_call_launch$NWE
ΜεταφοÏά- Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf αÏιθμός 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΜεταφοÏά- Conf αÏιθμός 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +if ($LOGdelete_ingroups > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟΠΤΟΠΣΤΗÎ-ΟΜΑΔΑ\n"; + } + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩÎ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκίνημα: (μόνο αÏιθμοί, incremented)$NWB#vicidial_remote_agents-user_start$NWE
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Διακομιστή: $NWB#vicidial_remote_agents-server_ip$NWE
ΕξωτεÏική Τηλ. ΣÏνδεση: ()$NWB#vicidial_remote_agents-conf_exten$NWE
Κατάσταση:$NWB#vicidial_remote_agents-status$NWE
ΕκστÏατείας:$NWB#vicidial_remote_agents-campaign_id$NWE
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + + +if ($LOGdelete_remote_agents > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟΠΤΟΠΜΑΚΡΙÎΟ ΠΡΑΚΤΟΡΑ\n"; + } + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΟΜΑΔΑΣ ΧΡΗΣΤΩÎ\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ομάδα: (όχι κενά ή στίξη)$NWB#vicidial_user_groups-user_group$NWE
ΠεÏιγÏαφή: (πεÏιγÏαφή ομάδας)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +if ($LOGdelete_user_groups > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟΠΤΟΠΧΡΗΣΤΗ GROUP\n"; + } + +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; +echo ""; + +echo "
ΤΡΟΠΟΠΟΙΗΣΤΕ ένα ΧΕΙΡΟΓΡΑΦΟ\n"; +echo "\n"; +echo "\n"; +echo "Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Name: (τίτλος του χειÏογÏάφου)$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Σχόλια: $NWB#vicidial_scripts-script_comments$NWE\n"; +echo "ΕνεÏγός:$NWB#vicidial_scripts-active$NWE\n"; +echo "Script Text:

ΧειÏόγÏαφο Ï€Ïόβλεψης $NWB#vicidial_scripts-script_text$NWE\n"; +echo "\n"; +echo "
\n"; + +if ($LOGdelete_scripts > 0) + { + echo "

ΔΙΑΓΡΑΨΤΕ ΑΥΤΟ ΤΟ ΧΕΙΡΟΓΡΑΦΟ\n"; + } + +} + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
ΑÎΑΖΗΤΗΣΗ ΧΡΗΣΤΗ\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
ΑÏιθμός ΧÏήστη:
ΠλήÏες Ονομα:
Επίπεδο ΧÏήστη:
Ομάδα ΧÏήστη:
\n"; + +} + +###################### +# ADD=66 user search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΑÎΑΖΗΤΗΣΗ ΑΠΟΤΕΛΕΣΜΑΤΩÎ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ | ΚΑΤΑΣΤΑΣΗ | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and user='$user' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and campaign_id='$campaign_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and list_id='$list_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ +echo "
\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTCAMPAIGNENTRY ΗΜΕΡΑCALLBACK ΗΜΕΡΑUSERRECIPIENT
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]
\n"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΧΡΗΣΤΗ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ | ΚΑΤΑΣΤΑΣΗ | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΕΚΣΤΡΑΤΕΙΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΛΙΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΕΙΣΕΡΧΟΜΕÎΕΣ ΟΜΑΔΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΟΜΑΔΕΣ ΧΡΗΣΤΗ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/admin_modify_lead.php b/LANG_admin/LANG_admin/vicidial_el/admin_modify_lead.php new file mode 100644 index 0000000..6ff4091 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/admin_modify_lead.php @@ -0,0 +1,321 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ΔΙΑΧ: ΤÏοποποίηση καθοδήγησης + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Οι πληÏοφοÏίες Ï„Ïοποποιήθηκαν

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
ΠληÏοφοÏίες Κλήσης: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     ID Λίστας: $list_id
Ονομα:   \n"; + echo " Επίθετο:
Πόλη :
  \n"; + echo " Ταχ.Κωδ.:
ΕπαÏχία :
ΧώÏα :
Σχόλια :
ΤεÏματισμός
\n"; + echo "


\n"; + + } + else + { + echo "ΑΠΟΤΥΧΙΑ ψαξίματος καθοδήγησης για lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "Κλήσεις για αυτή την καθοδήγηση:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where lead_id='$lead_id' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS TSRΕΚΣΤΡΑΤΕΙΑ LIST LEAD
$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
\n"; + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/admin_search_lead.php b/LANG_admin/LANG_admin/vicidial_el/admin_search_lead.php new file mode 100644 index 0000000..359ab21 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/admin_search_lead.php @@ -0,0 +1,185 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +### AST GUI database administration search for lead info +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ΔΙΑΧ: Αναζήτηση Καθοδήγησης + +Ψάξιμο Καθοδήγησης + + + +
\n"; + echo "
\n"; + echo "ΠαÏακαλώ καταχωÏήστε:
Vendor ID(αυτόματος κωδικός καθοδήγησης): or \n"; + echo "
ένας αÏιθμός τηλεφώνου ÏƒÏ€Î¹Ï„Î¹Î¿Ï or\n"; + echo "
ID καθοδήγησης

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='$vendor_id'"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='$phone'"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if (eregi('10.10.10.2',$ip)) + { + echo "\n\n$stmt\n\n"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($row[0]) < 3) && (strlen($row[1]) < 3) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "Οι μεταβλητές αναζήτησης που καταχωÏήσατε δεν είναι ενεÏγές στο σÏστημα

\n"; + echo "ΠαÏακαλώ, επιστÏέψτε πίσω και ελέγξτε τις πληÏοφοÏίες που καταχωÏήσατε και Ï€Ïοσπαθήστε πάλι\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "\n
\n\n";
+		echo "lead ID: $row[0]\n";
+		echo "status: $row[3]\n";
+		echo "vendor_id: $row[5]\n";
+		echo "last rep called: $row[4]\n";
+		echo "list_id: $row[7]\n";
+		echo "phone: $row[11]\n";
+		echo "Name: $row[13] $row[15]\n";
+		echo "Πόλη: $row[19]\n";
+		echo "Security: $row[28]\n";
+		echo "Σχόλια: $row[29]\n\n";
+		echo "\n";
+		echo "
\n"; + + # https://www.vicimarketing.com/internal/back_end_sys/uk_cust_serv/index.php?person_id=$row[7]&people_packages_id=&secure_lvl=2&display=2&username=$username&passwd=$passwd + + echo "Πατήστε εδώ για να δείτε τις λεπτομέÏειες του καθοδηγητή\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nÎΕΑ ΑÎΑΖΗΤΗΣΗ"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds"; + + +?> + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/count.htm b/LANG_admin/LANG_admin/vicidial_el/count.htm new file mode 100644 index 0000000..51f8a36 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/count.htm @@ -0,0 +1 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_el/dbconnect.php b/LANG_admin/LANG_admin/vicidial_el/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_el/group_hourly_stats.php b/LANG_admin/LANG_admin/vicidial_el/group_hourly_stats.php new file mode 100644 index 0000000..8846678 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/group_hourly_stats.php @@ -0,0 +1,227 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ΔΙΑΧ: + + +
+ + + + + += '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_no_hour 00:00:00' and call_date <= '$date_no_hour 23:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
  VICIDIAL ΔΙΑΧ:  
\n"; + +echo "
\n"; + +echo "ΜΕΤΡΗΣΗ ΩΡΩΠTSR: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
ΠαÏακαλώ, καταχωÏήστε την ομάδα για την οποία θέλετε στατιστικά ανά ÏŽÏα:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/help.gif b/LANG_admin/LANG_admin/vicidial_el/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/vicidial_el/help.gif differ diff --git a/LANG_admin/LANG_admin/vicidial_el/htglobalize.php b/LANG_admin/LANG_admin/vicidial_el/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/listloader.php b/LANG_admin/LANG_admin/vicidial_el/listloader.php new file mode 100644 index 0000000..f198ffe --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/listloader.php @@ -0,0 +1,187 @@ +\"ΒΟΗΘΕΙΑ\""; + +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + +
ΦόÏτιση καθοδηγητών από αυτό το αÏχείο:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("./vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
ΕπεξεÏγασία$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
Λάθος: Το αÏχείο ξεπέÏασε το ÏŒÏιο των 8ΜΒ.
"; +} +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/listloaderMAIN.php b/LANG_admin/LANG_admin/vicidial_el/listloaderMAIN.php new file mode 100644 index 0000000..1815613 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/listloaderMAIN.php @@ -0,0 +1,69 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + +VICIDIAL: Υπομονάδα φόÏτισης καθοδηγητών + + + + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/new_listloader_superL.php b/LANG_admin/LANG_admin/vicidial_el/new_listloader_superL.php new file mode 100644 index 0000000..30c9874 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/new_listloader_superL.php @@ -0,0 +1,747 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"ΒΟΗΘΕΙΑ\""; + +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ΔΙΑΧ: Super Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + + + + + + + + + + + + + + + +
ΦόÏτιση καθοδηγητών από αυτό το αÏχείο:
File layout to use:Standard VICIDIAL    Custom layout
        
CLICK HERE TO GO TO THE BASIC LEAD LOADER         BACK TO ADMIN
SUPER LIST LOADER-     VERSION:     BUILD:
+ + +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
ΕπεξεÏγασία$delim_name-delimited file...\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + print "
ΕπεξεÏγασίαExcel file... \n"; + # print "$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"; + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ΕπεξεÏγασίαCSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
ΕπεξεÏγασία$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + passthru("$WeBServeRRooT/vicidial/listloader.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ΕπεξεÏγασίαCSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $tbl_rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
ΕπεξεÏγασία$delim_name-delimited file...\n"; + + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ΕπεξεÏγασίαCSV file... \n"; + + $total=0; $good=0; $bad=0; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
Λάθος: Το αÏχείο ξεπέÏασε το ÏŒÏιο των 8ΜΒ.
"; +} +?> + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/remote_dispo.php b/LANG_admin/LANG_admin/vicidial_el/remote_dispo.php new file mode 100644 index 0000000..821bdfb --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/remote_dispo.php @@ -0,0 +1,279 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ΑπομακÏυσμένο VICIDIAL: ΤεÏματισμός Κλήσης + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='$call_length', status='$status', user='$PHP_AUTH_USER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments',user='$PHP_AUTH_USER' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Η κλήση έχει τεÏματίσει       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
ΠληÏοφοÏίες Κλήσης: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     ID ΕκστÏατείας: $campaign_id
Fronter: $tsr     ID Λίστας: $list_id
Ονομα:   \n"; + echo " Επίθετο:
Πόλη :
  \n"; + echo " Ταχ.Κωδ.:
ΕπαÏχία :
ΧώÏα :
Σχόλια :
ΤεÏματισμός
\n"; + echo "


\n"; + + } + else + { + echo "ΑΠΟΤΥΧΙΑ ψαξίματος καθοδήγησης για lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/server_stats.php b/LANG_admin/LANG_admin/vicidial_el/server_stats.php new file mode 100644 index 0000000..7623c7b --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/server_stats.php @@ -0,0 +1,70 @@ + + + + + + +VICIDIAL: Στατιστικά Διακομιστή and Reports + +

VICIDIAL: Στατιστικά Διακομιστή and Reports

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERΠΕΡΙΓΡΑΦΗIP ADDRESSΕÎΕΡΓΑVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_el/user_stats.php b/LANG_admin/LANG_admin/vicidial_el/user_stats.php new file mode 100644 index 0000000..6456544 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/user_stats.php @@ -0,0 +1,302 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ΔΙΑΧ: User Stats + + +
+ + + + + +\n"; +echo "
  VICIDIAL ΔΙΑΧ: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "ΧΡΟÎΟΣ ΟΜΙΛΙΑΣ ΚΑΙ ΚΑΤΑΣΤΑΣΗ:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
ΚΑΤΑΣΤΑΣΗΚΑΤΑΜΕΤΡΗΣΗΩΡΕΣ:ΛΕΠΤΑ
$row[1] $row[0] $call_hours_int:$call_minutes_int
ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo " ΧΡΟÎΟΣ ΣYÎΔΕΣΗΣ/ΑΠΟΣΥÎΔΕΣΗΣ:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='$user' and event_date >= '$begin_date 0:00:01' and event_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
ΣΥΜΒΑΠΗΜΕΡΑΕΚΣΤΡΑΤΕΙΑΩΡΕΣ:ΛΕΠΤΑ
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
ΣΥÎΟΛΙΚΑ $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "Τελευταίες 50 Κλήσεις:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='$user' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS PHONEΕΚΣΤΡΑΤΕΙΑ LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/user_status.php b/LANG_admin/LANG_admin/vicidial_el/user_status.php new file mode 100644 index 0000000..b8e1f65 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/user_status.php @@ -0,0 +1,223 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + $stmt="SELECT * from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ΔΙΑΧ: User Status + + +
+
+ + + + +\n"; +echo "
  VICIDIAL ΔΙΑΧ: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='$group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current ΕκστÏατείας:\n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name - \n"; + +echo "VICIDIAL Time Sheet\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_el/vdremote.php b/LANG_admin/LANG_admin/vicidial_el/vdremote.php new file mode 100644 index 0000000..58a2627 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_el/vdremote.php @@ -0,0 +1,584 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + + +$popup_page = './closer_popup.php'; +$version = '1.1.9'; +$build = '51123-1502'; +$STARTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + echo"\n"; + } +echo "\n"; +?> + + VICIDIAL ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧÏηστών";} +if ($ADD==41111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧÏηστών";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ:   ΑΠΟΣΥÎΔΕΣΗ  
  ΤΡΟΠΟΠΟΙΗΣΗ | ">ΚΑΤΑΣΤΑΣΗ | ">ΣΤΑΤΙΣΤΙΚΑ ΕΙΣΕΡΧΟΜΕÎΩÎ
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩÎ: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκίνημα: $user_start
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)
IP Διακομιστή: $row[3]
ΕξωτεÏική Τηλ. ΣÏνδεση: (number dialed to reach agents [i.e. 913125551212])
Κατάσταση:
ΕκστÏατείας:$campaign_id
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΡΗΣΤΕΣ ΤΡΟΠΟΠΟΙΗΘΗΚΑÎ\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΡΗΣΤΩÎ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκίνημα: $user_start
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)
IP Διακομιστή: $row[3]
ΕξωτεÏική Τηλ. ΣÏνδεση: (number dialed to reach agents [i.e. 913125551212])
Κατάσταση:
ΕκστÏατείας:$campaign_id
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]='- ΑÎΑΜΟÎΗ -'; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i ΧÏήστες συνδεμένοι στον διακομιστή $server_ip\n\n"; + + echo " - 5 λεπτά ή παÏαπάνω σε κλήση\n"; + echo " - Πάνω από 10 λεπτά σε κλήση\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* ΚΑÎΕÎΑΣ ΧΡΗΣΤΗΣ ΣΕ ΚΛΗΣΕΙΣ*********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - ΠαÏακαλώ επιστÏέψτε και εξετάστε τα στοιχεία που εισαγάγατε\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Στατιστικά εισεÏχομένων απομακÏυσμένου χÏήστη $NOW_TIME\n\n"; + echo "\n"; + echo "Συνολικές κλήσεις που διακομίστηκαν$query_date: $in_calls\n"; + echo "Συνολικός χÏόνος ομιλίας σε$query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Λίστα Κλήσεων για$query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i ΧÏήστες συνδεμένοι στον διακομιστή $server_ip\n\n"; + + # echo " - 5 λεπτά ή παÏαπάνω σε κλήση\n"; + # echo " - Πάνω από 10 λεπτά σε κλήση\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************ΔΕΠΥΠΑΡΧΟΥΠΚΛΗΣΕΙΣ ΣΕ ΑΥΤΗ ΤΗΠΗΜΕΡΑ*******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nδιαδικασία που Ï„Ïέχει: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_CLOSERstats.php b/LANG_admin/LANG_admin/vicidial_en/AST_CLOSERstats.php new file mode 100644 index 0000000..5ee6545 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_CLOSERstats.php @@ -0,0 +1,360 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_VDADstats.php b/LANG_admin/LANG_admin/vicidial_en/AST_VDADstats.php new file mode 100644 index 0000000..41580e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_VDADstats.php @@ -0,0 +1,390 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='NA' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+$NApercent = (($NAcalls / $TOTALcalls) * 100);
+$NApercent = round($NApercent, 0);
+
+$average_na_seconds = ($row[1] / $row[0]);
+$average_na_seconds = round($average_na_seconds, 0);
+$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+
+echo "Total NA calls -Busy,Disconnect,BTvoicemail:  $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_VICIDIAL_hopperlist.php b/LANG_admin/LANG_admin/vicidial_en/AST_VICIDIAL_hopperlist.php new file mode 100644 index 0000000..be9aa76 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,135 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} +if (!$server_ip) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+echo "|      | LEAD_ID   | PHONE NUM  | STATE | STATUS | COUNT | GMT    |\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now from vicidial_hopper,vicidial_list where vicidial_hopper.CAMPAIGN_ID='$group' and vicidial_hopper.lead_id=vicidial_list.lead_id order by hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+
+	echo "| $FMT_i | $lead_id | $phone_number | $state | $status | $count | $gmt |\n";
+
+	$i++;
+	}
+
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_admin_log_display.php b/LANG_admin/LANG_admin/vicidial_en/AST_admin_log_display.php new file mode 100644 index 0000000..8598686 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_admin_log_display.php @@ -0,0 +1,105 @@ + 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance.php b/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance.php new file mode 100644 index 0000000..7305f3c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance.php @@ -0,0 +1,205 @@ + + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='$group' group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance_detail.php b/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance_detail.php
new file mode 100644
index 0000000..8c7ec4c
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_en/AST_agent_performance_detail.php
@@ -0,0 +1,379 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$query_date=$_GET["query_date"];	if (!$query_date) {$query_date=$_POST["query_date"];}
+$group=$_GET["group"];				if (!$group) {$group=$_POST["group"];}
+$shift=$_GET["shift"];				if (!$shift) {$shift=$_POST["shift"];}
+$submit=$_GET["submit"];			if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];			if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 03:45:00";   
+	$query_date_END = "$query_date 15:15:00";
+	$time_BEGIN = "03:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:15:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TIME   | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG| A    | B    | DC   | DNC  | N    | NI   | CB   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='$group' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtime=($TOTtime + $row[1] + $row[5] + $row[7] + $row[9]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$TOTtotWAIT=($TOTtotWAIT + $row[7]);
+	$TOTtotPAUSE=($TOTtotPAUSE + $row[5]);
+	$TOTtotDISPO=($TOTtotDISPO + $row[9]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtime =	($row[1] + $row[5] + $row[7] + $row[9]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+	$USERtotPAUSE =	$row[5];
+	$USERavgPAUSE =	$row[6];
+	$USERtotWAIT =	$row[7];
+	$USERavgWAIT =	$row[8];
+	$USERtotDISPO =	$row[9];
+	$USERavgDISPO =	$row[10];
+
+	$USERtime_M = ($USERtime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS[$i] =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($USERtotPAUSE / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS[$i] =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($USERavgPAUSE / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS[$i] =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($USERtotWAIT / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS[$i] =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($USERavgWAIT / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS[$i] =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($USERtotDISPO / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS[$i] =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($USERavgDISPO / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS[$i] =		sprintf("%6s", $USERavgDISPO_MS);
+
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; $ctCB[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if (($row[1] == 'CALLBK') || ($row[1] == 'CBHOLD') ) {$ctCB[$k]=sprintf("%-4s", $row[0]);	$TOT_CB = ($TOT_CB + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtime_MS[$k]| $pfUSERtotPAUSE_MS[$k] | $pfUSERavgPAUSE_MS[$k] | $pfUSERtotWAIT_MS[$k] | $pfUSERavgWAIT_MS[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $pfUSERtotDISPO_MS[$k] | $pfUSERavgDISPO_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctCB[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = round($TOTtime_M, 2);
+	$TOTtime_M_int = intval("$TOTtime_M");
+	$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
+	$TOTtime_S = ($TOTtime_S * 60);
+	$TOTtime_S = round($TOTtime_S, 0);
+	if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%7s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>7) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%7s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>7) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%7s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>7) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%7s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>7) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+	
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_CB = sprintf("%-5s", $TOT_CB);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtime_MS| $TOTtotPAUSE_MS| $TOTavgPAUSE_MS | $TOTtotWAIT_MS| $TOTavgWAIT_MS | $TOTtotTALK_MS| $TOTavgTALK_MS | $TOTtotDISPO_MS| $TOTavgDISPO_MS | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_CB| $TOT_SALE|\n";
+echo "+--------------------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_agent_time_sheet.php b/LANG_admin/LANG_admin/vicidial_en/AST_agent_time_sheet.php
new file mode 100644
index 0000000..16f2f7e
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_en/AST_agent_time_sheet.php
@@ -0,0 +1,256 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$agent=$_GET["agent"];						if (!$agent) {$agent=$_POST["agent"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$calls_summary=$_GET["calls_summary"];		if (!$calls_summary) {$calls_summary=$_POST["calls_summary"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];					if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_server_performance.php b/LANG_admin/LANG_admin/vicidial_en/AST_server_performance.php
new file mode 100644
index 0000000..36d1b00
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_en/AST_server_performance.php
@@ -0,0 +1,283 @@
+
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Server Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:32:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:32:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$HIGHload =	sprintf("%10s", $row[0]);
+$HIGHmulti = intval($HIGHload / 100);
+#$HIGHmulti = ($HIGHload / 100);
+
+$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$USEDram =	sprintf("%10s", $row[0]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365') and  start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average channels in use for server:       $AVGchannels\n";
+echo "Average load for server:                  $AVGload\n";
+echo "Peak load for server:                     $HIGHload\n";
+#echo "Peak used memory for server (in MB):      $USEDram\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHload\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc 30 minutes\n";
+$HTMcontent .= "minorticinc: 5 minutes\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD.php b/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD.php new file mode 100644 index 0000000..d55705f --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD.php @@ -0,0 +1,231 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	$agentcount=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED",$row[4]))
+			{
+			$row[3]='';
+			$row[5]=' - WAITING - ';
+			$row[6]=$row[7];
+			}
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$sessionid =		sprintf("%-9s", $row[2]);
+		$channel =			sprintf("%-10s", $row[3]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[4]);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 5) {$G=''; $EG='';}
+		if ($call_time_M_int >= 10) {$G=''; $EG='';}
+		if (eregi("PAUSED",$row[4])) 
+			{
+			if ($call_time_M_int >= 1) 
+				{$i++; continue;} 
+			else
+				{$G=''; $EG='';}
+			}
+
+		$agentcount++;
+		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-8s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD_closer.php b/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD_closer.php new file mode 100644 index 0000000..cefa232 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/AST_timeonVDAD_closer.php @@ -0,0 +1,289 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] =		sprintf("%-10s", $row[0]);
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where uniqueid='$uniqueid[$i]' and server_ip='$server_ip';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/admin.php b/LANG_admin/LANG_admin/vicidial_en/admin.php new file mode 100644 index 0000000..43f7fc2 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/admin.php @@ -0,0 +1,4156 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$full_name=$_GET["full_name"]; if (!$full_name) {$full_name=$_POST["full_name"];} +$user_level=$_GET["user_level"]; if (!$user_level) {$user_level=$_POST["user_level"];} +$user_group=$_GET["user_group"]; if (!$user_group) {$user_group=$_POST["user_group"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$campaign_name=$_GET["campaign_name"]; if (!$campaign_name) {$campaign_name=$_POST["campaign_name"];} +$active=$_GET["active"]; if (!$active) {$active=$_POST["active"];} +$park_ext=$_GET["park_ext"]; if (!$park_ext) {$park_ext=$_POST["park_ext"];} +$park_file_name=$_GET["park_file_name"]; if (!$park_file_name) {$park_file_name=$_POST["park_file_name"];} +$web_form_address=$_GET["web_form_address"]; if (!$web_form_address) {$web_form_address=$_POST["web_form_address"];} +$allow_closers=$_GET["allow_closers"]; if (!$allow_closers) {$allow_closers=$_POST["allow_closers"];} +$hopper_level=$_GET["hopper_level"]; if (!$hopper_level) {$hopper_level=$_POST["hopper_level"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$next_agent_call=$_GET["next_agent_call"]; if (!$next_agent_call) {$next_agent_call=$_POST["next_agent_call"];} +$local_call_time=$_GET["local_call_time"]; if (!$local_call_time) {$local_call_time=$_POST["local_call_time"];} +$voicemail_ext=$_GET["voicemail_ext"]; if (!$voicemail_ext) {$voicemail_ext=$_POST["voicemail_ext"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$list_name=$_GET["list_name"]; if (!$list_name) {$list_name=$_POST["list_name"];} +$group_id=$_GET["group_id"]; if (!$group_id) {$group_id=$_POST["group_id"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$group_color=$_GET["group_color"]; if (!$group_color) {$group_color=$_POST["group_color"];} +$fronter_display=$_GET["fronter_display"]; if (!$fronter_display) {$fronter_display=$_POST["fronter_display"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$dial_status_a=$_GET["dial_status_a"]; if (!$dial_status_a) {$dial_status_a=$_POST["dial_status_a"];} +$dial_status_b=$_GET["dial_status_b"]; if (!$dial_status_b) {$dial_status_b=$_POST["dial_status_b"];} +$dial_status_c=$_GET["dial_status_c"]; if (!$dial_status_c) {$dial_status_c=$_POST["dial_status_c"];} +$dial_status_d=$_GET["dial_status_d"]; if (!$dial_status_d) {$dial_status_d=$_POST["dial_status_d"];} +$dial_status_e=$_GET["dial_status_e"]; if (!$dial_status_e) {$dial_status_e=$_POST["dial_status_e"];} +$lead_order=$_GET["lead_order"]; if (!$lead_order) {$lead_order=$_POST["lead_order"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$campaign_vdad_exten=$_GET["campaign_vdad_exten"]; if (!$campaign_vdad_exten) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +$campaign_rec_exten=$_GET["campaign_rec_exten"]; if (!$campaign_rec_exten) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +$campaign_recording=$_GET["campaign_recording"]; if (!$campaign_recording) {$campaign_recording=$_POST["campaign_recording"];} +$campaign_rec_filename=$_GET["campaign_rec_filename"]; if (!$campaign_rec_filename) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +$hotkey=$_GET["hotkey"]; if (!$hotkey) {$hotkey=$_POST["hotkey"];} +$reset_list=$_GET["reset_list"]; if (!$reset_list) {$reset_list=$_POST["reset_list"];} +$old_campaign_id=$_GET["old_campaign_id"]; if (!$old_campaign_id) {$old_campaign_id=$_POST["old_campaign_id"];} +$OLDuser_group=$_GET["OLDuser_group"]; if (!$OLDuser_group) {$OLDuser_group=$_POST["OLDuser_group"];} +$status_name=$_GET["status_name"]; if (!$status_name) {$status_name=$_POST["status_name"];} +$selectable=$_GET["selectable"]; if (!$selectable) {$selectable=$_POST["selectable"];} +$HKstatus=$_GET["HKstatus"]; if (!$HKstatus) {$HKstatus=$_POST["HKstatus"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} +$delete_users=$_GET["delete_users"]; if (!$delete_users) {$delete_users=$_POST["delete_users"];} +$delete_user_groups=$_GET["delete_user_groups"]; if (!$delete_user_groups) {$delete_user_groups=$_POST["delete_user_groups"];} +$delete_lists=$_GET["delete_lists"]; if (!$delete_lists) {$delete_lists=$_POST["delete_lists"];} +$delete_campaigns=$_GET["delete_campaigns"]; if (!$delete_campaigns) {$delete_campaigns=$_POST["delete_campaigns"];} +$delete_ingroups=$_GET["delete_ingroups"]; if (!$delete_ingroups) {$delete_ingroups=$_POST["delete_ingroups"];} +$delete_remote_agents=$_GET["delete_remote_agents"]; if (!$delete_remote_agents) {$delete_remote_agents=$_POST["delete_remote_agents"];} +$load_leads=$_GET["load_leads"]; if (!$load_leads) {$load_leads=$_POST["load_leads"];} +$campaign_detail=$_GET["campaign_detail"]; if (!$campaign_detail) {$campaign_detail=$_POST["campaign_detail"];} +$ast_admin_access=$_GET["ast_admin_access"]; if (!$ast_admin_access) {$ast_admin_access=$_POST["ast_admin_access"];} +$ast_delete_phones=$_GET["ast_delete_phones"]; if (!$ast_delete_phones) {$ast_delete_phones=$_POST["ast_delete_phones"];} +$CoNfIrM=$_GET["CoNfIrM"]; if (!$CoNfIrM) {$CoNfIrM=$_POST["CoNfIrM"];} +$delete_scripts=$_GET["delete_scripts"]; if (!$delete_scripts) {$delete_scripts=$_POST["delete_scripts"];} +$script_id=$_GET["script_id"]; if (!$script_id) {$script_id=$_POST["script_id"];} + $script_id = strtoupper($script_id); +$script_name=$_GET["script_name"]; if (!$script_name) {$script_name=$_POST["script_name"];} +$script_comments=$_GET["script_comments"]; if (!$script_comments) {$script_comments=$_POST["script_comments"];} +$script_text=$_GET["script_text"]; if (!$script_text) {$script_text=$_POST["script_text"];} +$reset_hopper=$_GET["reset_hopper"]; if (!$reset_hopper) {$reset_hopper=$_POST["reset_hopper"];} +$get_call_launch=$_GET["get_call_launch"]; if (!$get_call_launch) {$get_call_launch=$_POST["get_call_launch"];} +$am_message_exten=$_GET["am_message_exten"]; if (!$am_message_exten) {$am_message_exten=$_POST["am_message_exten"];} +$amd_send_to_vmx=$_GET["amd_send_to_vmx"]; if (!$amd_send_to_vmx) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"]; if (!$xferconf_a_dtmf) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +$xferconf_a_number=$_GET["xferconf_a_number"]; if (!$xferconf_a_number) {$xferconf_a_number=$_POST["xferconf_a_number"];} +$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"]; if (!$xferconf_b_dtmf) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +$xferconf_b_number=$_GET["xferconf_b_number"]; if (!$xferconf_b_number) {$xferconf_b_number=$_POST["xferconf_b_number"];} +$modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST["modify_leads"];} +$hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} +$change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} +$agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} + + + + +### AST GUI database administration +### admin.php +### +### CHANGES +### 50315-1110 - Added Custom Campaign Statuses +### 50317-1438 - Added Fronter Display var to inbound groups +### 50322-1355 - Added custom callerID per campaign +### 50517-1356 - Added user_groups sections and user_group to vicidial_users +### 50517-1440 - Added ability to logout (must click OK with empty user/pass) +### 50602-1622 - Added lead loader pages to load new files into vicidial_list +### 50620-1351 - Added custom vdad transfer AGI extension per campaign +### 50810-1414 - modified in groups to kick out spaces and dashes +### 50908-2136 - Added Custom Campaign HotKeys +### 50914-0950 - Fixed user search by user_group +### 50926-1358 - Modified to allow for language translation +### 50926-1615 - Added WeBRooTWritablE write controls +### 51020-1008 - Added editable web address and park ext - NEW dial campaigns +### 51020-1056 - Added fields and help for campaign recording control +### 51123-1335 - Altered code to function in php globals=off +### 51208-1038 - Added user_level changes, function controls and default user phones +### 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +### 51213-1706 - Added add/delete/modify vicidial scripts +### 51214-1737 - Added preview of vicidial script in popup window +### 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +### 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +### 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +### 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +### 60204-0659 - Fixed hopper reset bug +### 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +### 60213-1100 - Added several vicidial_users permissions fields +### 60215-1319 - Added On-hold CallBacks display and links +### 60227-1226 - Fixed vicidial_inbound_groups insert bug + +### 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 + +$version = '1.1.10-5'; +$build = '60227-1226'; + +$STARTtime = date("U"); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGdelete_scripts =$row[18]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if ($ADD==1) {echo "Add New User";} +if ($ADD==11) {echo "Add New Campaign";} +if ($ADD==111) {echo "Add New List";} +if ($ADD==1111) {echo "Add New In-Group";} +if ($ADD==11111) {echo "Add New Remote Agents";} +if ($ADD==111111) {echo "Add New Users Group";} +if ($ADD==1111111) {echo "Add New Script";} +if ($ADD==2) {echo "New User Addition";} +if ($ADD==21) {echo "New Campaign Addition";} +if ($ADD==22) {echo "New Campaign Status Addition";} +if ($ADD==23) {echo "New Campaign HotKey Addition";} +if ($ADD==211) {echo "New List Addition";} +if ($ADD==2111) {echo "New In-Group Addition";} +if ($ADD==21111) {echo "New Remote Agents Addition";} +if ($ADD==211111) {echo "New Users Group Addition";} +if ($ADD==2111111) {echo "New Script Addition";} +if ($ADD==3) {echo "Modify User";} +if ($ADD==31) {echo "Modify Campaign";} +if ($ADD==34) {echo "Modify Campaign - Basic View";} +if ($ADD==311) {echo "Modify List";} +if ($ADD==3111) {echo "Modify In-Group";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==311111) {echo "Modify Users Groups";} +if ($ADD==3111111) {echo "Modify Script";} +if ($ADD=="4A") {echo "Modify User - Admin";} +if ($ADD==4) {echo "Modify User";} +if ($ADD==41) {echo "Modify Campaign";} +if ($ADD==42) {echo "Modify Campaign Status";} +if ($ADD==43) {echo "Modify Campaign HotKey";} +if ($ADD==44) {echo "Modify Campaign - Basic View";} +if ($ADD==411) {echo "Modify List";} +if ($ADD==4111) {echo "Modify In-Group";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==411111) {echo "Modify Users Groups";} +if ($ADD==4111111) {echo "Modify Script";} +if ($ADD==5) {echo "Delete User";} +if ($ADD==51) {echo "Delete Campaign";} +if ($ADD==52) {echo "Logout Agents";} +if ($ADD==511) {echo "Delete List";} +if ($ADD==5111) {echo "Delete In-Group";} +if ($ADD==51111) {echo "Delete Remote Agents";} +if ($ADD==511111) {echo "Delete Users Group";} +if ($ADD==5111111) {echo "Delete Script";} +if ($ADD==6) {echo "Delete User";} +if ($ADD==61) {echo "Delete Campaign";} +if ($ADD==62) {echo "Logout Agents";} +if ($ADD==611) {echo "Delete List";} +if ($ADD==6111) {echo "Delete In-Group";} +if ($ADD==61111) {echo "Delete Remote Agents";} +if ($ADD==611111) {echo "Delete Users Group";} +if ($ADD==6111111) {echo "Delete Script";} +if ($ADD==7111111) {echo "Preview Script";} +if ($ADD==0) {echo "Welcome";} +if ($ADD==8) {echo "CallBacks Within Agent";} +if ($ADD==81) {echo "CallBacks Within Campaign";} +if ($ADD==811) {echo "CallBacks Within List";} +if ($ADD==10) {echo "Campaigns";} +if ($ADD==100) {echo "Lists";} +if ($ADD==1000) {echo "In-Groups";} +if ($ADD==10000) {echo "Remote Agents";} +if ($ADD==100000) {echo "User Groups";} +if ($ADD==1000000) {echo "Scripts";} +if ($ADD==55) {echo "Search Form";} +if ($ADD==66) {echo "Search Results";} +if ($ADD==99999) {echo "HELP";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rsltx=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rsltx); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or ($ADD=="4A") ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<100) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"../astguiclient/help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, 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. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+HotKeys Active - This option if set to 1 allows the user to use the HotKeys quick-dispositioning function in vicidial.php. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_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. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL 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. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Dial Timeout - If defined, calls that would normally hangup after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dialplan - extensions.conf. + +
+
+
+Campaign CallerID - 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. This option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on. This feature may also work with IAX2 trunks depending on what your provider allows. The custom callerID only applies to calls placed for the VICIDIAL 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. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. 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 upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. 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. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dialplan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL 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 VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Voicemail - If defined, this is the Voicemail box that calls will go to instead of being dropped if no agents are available after the hold time is up. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - 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 VICIDIAL 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. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dialplan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+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 VICIDIAL as a disposition. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hotkeys, agents that use the vicidial web-client can hangup and disposition calls just by pressing a single key on their keyboard. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial 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. + +
+
+Script Name - This is the title of a Vicidial 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. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today? + +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL 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 vicidial_list table. There is also a new beta version super lead loader that 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 or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /home/cron/AST_SERVER_conf.pl file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. + +







+







+THE END +
+\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + + +?> + + + + +\n"; +echo "English \n";echo "Español \n";echo "Ελληνικά \n";?> +
+ + + + + + + +
  VICIDIAL ADMIN - Logout  
  LIST USERS | ADD A NEW USER | SEARCH FOR A USER |               |ADD USER GROUP | LIST USER GROUPS
  ADD CAMPAIGN | LIST CAMPAIGNS |              | SHOW LISTS | ADD NEW LIST |               | LOAD NEW LEADS
  SHOW IN-GROUPS | ADD NEW IN-GROUP |               | SHOW REMOTE AGENTS | ADD NEW REMOTE AGENTS
  STATS AND REPORTS               | ADD SCRIPT | VIEW SCRIPTS |             | SEARCH FOR A LEAD | GROUP HOURLY
+"; + +echo "
ADD A NEW USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "$NWB#vicidial_users-user_group$NWE\n"; +echo "\n"; +echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW CAMPAIGN\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
ADD A NEW INBOUND GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
ADD NEW REMOTE AGENTS\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
ADD NEW USERS GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ +echo ""; + +echo "
ADD NEW SCRIPT\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: $NWB#vicidial_scripts-script_text$NWE
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\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');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch')|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } + } +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOTKEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOTKEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOTKEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch'|\n"); + fclose($fp); + } + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|'$script_id','$script_name','$script_comments','$script_text','$active'|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|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' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOTKEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + } + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id'|\n"); + fclose($fp); + } + } + +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + } + } + +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id'|\n"); + fclose($fp); + } + } + +$ADD=3111111; # go to script modification form below +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to user group modification below +} + + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|user='$user'|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents fro a campaign +###################### + +if ($ADD==62) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='31'; # go to campaign modification below +} +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to user group list +} + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + +if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } +else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + {echo "\n";} + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level > 8) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
HotKeys Active: $NWB#vicidial_users-hotkeys_active$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_users-closer_campaigns$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + +echo "
MODIFY A CAMPAIGNS RECORD: $row[0] - Basic View | Detail View\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
STATUSDESCRIPTIONSELECTABLEDELETE
$rowx[0]$rowx[1]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; +echo "\n"; +echo "\n"; +echo "Status:   \n"; +echo "Description:   \n"; +echo "Selectable:   \n"; +echo "
\n"; + +echo "

\n"; + + + +echo "
CUSTOM HOTKEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
HOTKEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN HOTKEY
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Hotkey:   \n"; +echo "Status:   \n"; +echo "
\n"; + +echo "

\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ($ADD==34) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Basic View | Detail View
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + +echo "
\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
MODIFY A LISTS RECORD: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
STATUSES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[0] == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
STATUSCALLEDNOT CALLED
$CLB$rowx[0]$CLE $rowx[2]
$CLB$rowx[0]$CLE$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
TIME ZONES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
STATUS$firstSUBTOTAL
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + +echo "
MODIFY A GROUPS RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + + +echo "\n"; +echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +if ($LOGdelete_ingroups > 0) + { + echo "

DELETE THIS IN-GROUP\n"; + } + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + +if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
MODIFY A USERS GROUP ENTRY\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; +echo ""; + +echo "
MODIFY A SCRIPT\n"; +echo "\n"; +echo "\n"; +echo "Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Comments: $NWB#vicidial_scripts-script_comments$NWE\n"; +echo "Active: $NWB#vicidial_scripts-active$NWE\n"; +echo "Script Text:

Preview Script $NWB#vicidial_scripts-script_text$NWE\n"; +echo "\n"; +echo "
\n"; + +if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + +} + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
SEARCH FOR A USER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=66 user search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and user='$user' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and campaign_id='$campaign_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and list_id='$list_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ +echo "
\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTCAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENT
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]
\n"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/admin_modify_lead.php b/LANG_admin/LANG_admin/vicidial_en/admin_modify_lead.php new file mode 100644 index 0000000..9440ee5 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/admin_modify_lead.php @@ -0,0 +1,321 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead record modification + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where lead_id='$lead_id' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
\n"; + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/admin_search_lead.php b/LANG_admin/LANG_admin/vicidial_en/admin_search_lead.php new file mode 100644 index 0000000..e5d4af3 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/admin_search_lead.php @@ -0,0 +1,185 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration search for lead info +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + + +
\n"; + echo "
\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='$vendor_id'"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='$phone'"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if (eregi('10.10.10.2',$ip)) + { + echo "\n\n$stmt\n\n"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($row[0]) < 3) && (strlen($row[1]) < 3) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "\n
\n\n";
+		echo "lead ID: $row[0]\n";
+		echo "status: $row[3]\n";
+		echo "vendor_id: $row[5]\n";
+		echo "last rep called: $row[4]\n";
+		echo "list_id: $row[7]\n";
+		echo "phone: $row[11]\n";
+		echo "Name: $row[13] $row[15]\n";
+		echo "City: $row[19]\n";
+		echo "Security: $row[28]\n";
+		echo "Comments: $row[29]\n\n";
+		echo "\n";
+		echo "
\n"; + + # https://www.vicimarketing.com/internal/back_end_sys/uk_cust_serv/index.php?person_id=$row[7]&people_packages_id=&secure_lvl=2&display=2&username=$username&passwd=$passwd + + echo "Click here to see the Lead Details\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/count.htm b/LANG_admin/LANG_admin/vicidial_en/count.htm new file mode 100644 index 0000000..51f8a36 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/count.htm @@ -0,0 +1 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_en/dbconnect.php b/LANG_admin/LANG_admin/vicidial_en/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_en/group_hourly_stats.php b/LANG_admin/LANG_admin/vicidial_en/group_hourly_stats.php new file mode 100644 index 0000000..1da7356 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/group_hourly_stats.php @@ -0,0 +1,227 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats + + +
+ + + + + += '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_no_hour 00:00:00' and call_date <= '$date_no_hour 23:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
  VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/help.gif b/LANG_admin/LANG_admin/vicidial_en/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/vicidial_en/help.gif differ diff --git a/LANG_admin/LANG_admin/vicidial_en/htglobalize.php b/LANG_admin/LANG_admin/vicidial_en/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/listloader.php b/LANG_admin/LANG_admin/vicidial_en/listloader.php new file mode 100644 index 0000000..85b606c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/listloader.php @@ -0,0 +1,187 @@ +\"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + +
Load leads from this file:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("./vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/listloaderMAIN.php b/LANG_admin/LANG_admin/vicidial_en/listloaderMAIN.php new file mode 100644 index 0000000..c743747 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/listloaderMAIN.php @@ -0,0 +1,69 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/new_listloader_superL.php b/LANG_admin/LANG_admin/vicidial_en/new_listloader_superL.php new file mode 100644 index 0000000..734a3fe --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/new_listloader_superL.php @@ -0,0 +1,747 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Super Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + + + + + + + + + + + + + + + +
Load leads from this file:
File layout to use:Standard VICIDIAL    Custom layout
        
CLICK HERE TO GO TO THE BASIC LEAD LOADER         BACK TO ADMIN
SUPER LIST LOADER-     VERSION:     BUILD:
+ + +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + print "
Processing Excel file... \n"; + # print "$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"; + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + passthru("$WeBServeRRooT/vicidial/listloader.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $tbl_rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + $total=0; $good=0; $bad=0; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/remote_dispo.php b/LANG_admin/LANG_admin/vicidial_en/remote_dispo.php new file mode 100644 index 0000000..2839dab --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/remote_dispo.php @@ -0,0 +1,279 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='$call_length', status='$status', user='$PHP_AUTH_USER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments',user='$PHP_AUTH_USER' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/server_stats.php b/LANG_admin/LANG_admin/vicidial_en/server_stats.php new file mode 100644 index 0000000..4ee2c25 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/server_stats.php @@ -0,0 +1,70 @@ + + + + + + +VICIDIAL: Server Stats and Reports + +

VICIDIAL: Server Stats and Reports

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_en/user_stats.php b/LANG_admin/LANG_admin/vicidial_en/user_stats.php new file mode 100644 index 0000000..c31c425 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/user_stats.php @@ -0,0 +1,302 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats + + +
+ + + + + +\n"; +echo "
  VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='$user' and event_date >= '$begin_date 0:00:01' and event_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGNHOURS:MINUTES
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "LAST 50 CALLS:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='$user' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS PHONE CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/user_status.php b/LANG_admin/LANG_admin/vicidial_en/user_status.php new file mode 100644 index 0000000..7fcf684 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/user_status.php @@ -0,0 +1,223 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + $stmt="SELECT * from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status + + +
+
+ + + + +\n"; +echo "
  VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='$group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name - \n"; + +echo "VICIDIAL Time Sheet\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_en/vdremote.php b/LANG_admin/LANG_admin/vicidial_en/vdremote.php new file mode 100644 index 0000000..ae35d2c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_en/vdremote.php @@ -0,0 +1,584 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + +$popup_page = './closer_popup.php'; +$version = '1.1.9'; +$build = '51123-1502'; +$STARTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_CLOSERstats.php b/LANG_admin/LANG_admin/vicidial_es/AST_CLOSERstats.php new file mode 100644 index 0000000..9afe80d --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_CLOSERstats.php @@ -0,0 +1,360 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Estadísticas de VDAD Closer\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Estadísticas de Auto-dial en CLOSER                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaña:        $TOTALcalls\n";
+echo "Longitud media para las llamadas en segundos: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls: $DROPcalls  $DROPpercent%\n";
+echo "Longitud media para las llamadas DROP en segundos:    $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL USUARIO\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USUARIO                  | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LLAMADAS TOTALES PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_VDADstats.php b/LANG_admin/LANG_admin/vicidial_es/AST_VDADstats.php new file mode 100644 index 0000000..587414a --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_VDADstats.php @@ -0,0 +1,390 @@ + + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaña:        $TOTALcalls\n";
+echo "Longitud media para las llamadas en segundos: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls: $DROPcalls  $DROPpercent%\n";
+echo "Longitud media para las llamadas DROP en segundos:    $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL SIN RESPUESTA\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='NA' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+$NApercent = (($NAcalls / $TOTALcalls) * 100);
+$NApercent = round($NApercent, 0);
+
+$average_na_seconds = ($row[1] / $row[0]);
+$average_na_seconds = round($average_na_seconds, 0);
+$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+
+echo "Llamadas sin Respuesta - ocupado, desconexión,..:  $NAcalls  $NApercent%\n";
+echo "Longitud media para las Llamadas sin Respuesta en segundos:       $average_na_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL USUARIO\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USUARIO                  | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LLAMADAS TOTALES PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_VICIDIAL_hopperlist.php b/LANG_admin/LANG_admin/vicidial_es/AST_VICIDIAL_hopperlist.php new file mode 100644 index 0000000..4594336 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,135 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ENVIAR=$_GET["ENVIAR"]; if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} +if (!$server_ip) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Lista De Hopper\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA ARRIBA Y El TECLEO SOMETE\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Lista De Hopper                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total de Leads en el hopper ahora mismo:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+echo "|      | LEAD_ID   | PHONE NUM  | STATE | STATUS | COUNT | GMT    |\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now from vicidial_hopper,vicidial_list where vicidial_hopper.CAMPAIGN_ID='$group' and vicidial_hopper.lead_id=vicidial_list.lead_id order by hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+
+	echo "| $FMT_i | $lead_id | $phone_number | $state | $status | $count | $gmt |\n";
+
+	$i++;
+	}
+
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_admin_log_display.php b/LANG_admin/LANG_admin/vicidial_es/AST_admin_log_display.php new file mode 100644 index 0000000..50caae8 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_admin_log_display.php @@ -0,0 +1,105 @@ + 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance.php b/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance.php new file mode 100644 index 0000000..25c6e59 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance.php @@ -0,0 +1,205 @@ + + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='$group' group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance_detail.php b/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance_detail.php
new file mode 100644
index 0000000..79cd748
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_es/AST_agent_performance_detail.php
@@ -0,0 +1,379 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$query_date=$_GET["query_date"];	if (!$query_date) {$query_date=$_POST["query_date"];}
+$group=$_GET["group"];				if (!$group) {$group=$_POST["group"];}
+$shift=$_GET["shift"];				if (!$shift) {$shift=$_POST["shift"];}
+$submit=$_GET["submit"];			if (!$submit) {$submit=$_POST["submit"];}
+$ENVIAR=$_GET["ENVIAR"];			if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 03:45:00";   
+	$query_date_END = "$query_date 15:15:00";
+	$time_BEGIN = "03:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:15:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TIME   | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG| A    | B    | DC   | DNC  | N    | NI   | CB   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='$group' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtime=($TOTtime + $row[1] + $row[5] + $row[7] + $row[9]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$TOTtotWAIT=($TOTtotWAIT + $row[7]);
+	$TOTtotPAUSE=($TOTtotPAUSE + $row[5]);
+	$TOTtotDISPO=($TOTtotDISPO + $row[9]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtime =	($row[1] + $row[5] + $row[7] + $row[9]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+	$USERtotPAUSE =	$row[5];
+	$USERavgPAUSE =	$row[6];
+	$USERtotWAIT =	$row[7];
+	$USERavgWAIT =	$row[8];
+	$USERtotDISPO =	$row[9];
+	$USERavgDISPO =	$row[10];
+
+	$USERtime_M = ($USERtime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS[$i] =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($USERtotPAUSE / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS[$i] =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($USERavgPAUSE / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS[$i] =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($USERtotWAIT / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS[$i] =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($USERavgWAIT / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS[$i] =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($USERtotDISPO / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS[$i] =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($USERavgDISPO / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS[$i] =		sprintf("%6s", $USERavgDISPO_MS);
+
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; $ctCB[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if (($row[1] == 'CALLBK') || ($row[1] == 'CBHOLD') ) {$ctCB[$k]=sprintf("%-4s", $row[0]);	$TOT_CB = ($TOT_CB + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtime_MS[$k]| $pfUSERtotPAUSE_MS[$k] | $pfUSERavgPAUSE_MS[$k] | $pfUSERtotWAIT_MS[$k] | $pfUSERavgWAIT_MS[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $pfUSERtotDISPO_MS[$k] | $pfUSERavgDISPO_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctCB[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = round($TOTtime_M, 2);
+	$TOTtime_M_int = intval("$TOTtime_M");
+	$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
+	$TOTtime_S = ($TOTtime_S * 60);
+	$TOTtime_S = round($TOTtime_S, 0);
+	if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%7s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>7) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%7s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>7) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%7s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>7) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%7s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>7) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+	
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_CB = sprintf("%-5s", $TOT_CB);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtime_MS| $TOTtotPAUSE_MS| $TOTavgPAUSE_MS | $TOTtotWAIT_MS| $TOTavgWAIT_MS | $TOTtotTALK_MS| $TOTavgTALK_MS | $TOTtotDISPO_MS| $TOTavgDISPO_MS | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_CB| $TOT_SALE|\n";
+echo "+--------------------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_agent_time_sheet.php b/LANG_admin/LANG_admin/vicidial_es/AST_agent_time_sheet.php
new file mode 100644
index 0000000..21ddb77
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_es/AST_agent_time_sheet.php
@@ -0,0 +1,256 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$agent=$_GET["agent"];						if (!$agent) {$agent=$_POST["agent"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$calls_summary=$_GET["calls_summary"];		if (!$calls_summary) {$calls_summary=$_POST["calls_summary"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$ENVIAR=$_GET["ENVIAR"];					if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "LLAMADAS TOTALES TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_server_performance.php b/LANG_admin/LANG_admin/vicidial_es/AST_server_performance.php
new file mode 100644
index 0000000..c8fc2b6
--- /dev/null
+++ b/LANG_admin/LANG_admin/vicidial_es/AST_server_performance.php
@@ -0,0 +1,283 @@
+
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Server Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:32:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:32:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$HIGHload =	sprintf("%10s", $row[0]);
+$HIGHmulti = intval($HIGHload / 100);
+#$HIGHmulti = ($HIGHload / 100);
+
+$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$USEDram =	sprintf("%10s", $row[0]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365') and  start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average channels in use for server:       $AVGchannels\n";
+echo "Average load for server:                  $AVGload\n";
+echo "Peak load for server:                     $HIGHload\n";
+#echo "Peak used memory for server (in MB):      $USEDram\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHload\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc 30 minutes\n";
+$HTMcontent .= "minorticinc: 5 minutes\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD.php b/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD.php new file mode 100644 index 0000000..0554352 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD.php @@ -0,0 +1,231 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Tiempo de los  Agentes En Llamadas                       $NOW_TIME\n\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	$agentcount=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- ESPERANDO -';
+			$row[6]=$row[7];
+			}
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$sessionid =		sprintf("%-9s", $row[2]);
+		$channel =			sprintf("%-10s", $row[3]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[4]);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 5) {$G=''; $EG='';}
+		if ($call_time_M_int >= 10) {$G=''; $EG='';}
+		if (eregi("PAUSED",$row[4])) 
+			{
+			if ($call_time_M_int >= 1) 
+				{$i++; continue;} 
+			else
+				{$G=''; $EG='';}
+			}
+
+		$agentcount++;
+		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+		echo "  $agentcount agentes identificados en el servidor $server_ip\n\n";
+
+		echo "             - Agentes detenidos brevemente\n";
+		echo "             - Llamadas de 5 minutos o más\n";
+		echo "             - Sobre 10 minutos en llamada\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************AGENTES SIN LLAMADAS*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-8s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+		echo "  $i llamadas en el servidor $server_ip\n\n";
+
+		echo "             - LLAMADAS ACTUALES EN ESPERA\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************LLAMADAS EN ESPERA*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + diff --git a/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD_closer.php b/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD_closer.php new file mode 100644 index 0000000..88f1b48 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/AST_timeonVDAD_closer.php @@ -0,0 +1,289 @@ + 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Tiempo de los  Agentes En Llamadas                       $NOW_TIME\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] =		sprintf("%-10s", $row[0]);
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where uniqueid='$uniqueid[$i]' and server_ip='$server_ip';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agentes identificados en el servidor $server_ip\n\n";
+
+	#	echo "             - Llamadas de 5 minutos o más\n";
+	#	echo "             - Sobre 10 minutos en llamada\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************AGENTES SIN LLAMADAS*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i llamadas en el servidor $server_ip\n\n";
+
+		echo "             - LLAMADAS ACTUALES EN ESPERA\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************LLAMADAS EN ESPERA*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/admin.php b/LANG_admin/LANG_admin/vicidial_es/admin.php new file mode 100644 index 0000000..40ca211 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/admin.php @@ -0,0 +1,4156 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$full_name=$_GET["full_name"]; if (!$full_name) {$full_name=$_POST["full_name"];} +$user_level=$_GET["user_level"]; if (!$user_level) {$user_level=$_POST["user_level"];} +$user_group=$_GET["user_group"]; if (!$user_group) {$user_group=$_POST["user_group"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$campaign_name=$_GET["campaign_name"]; if (!$campaign_name) {$campaign_name=$_POST["campaign_name"];} +$active=$_GET["active"]; if (!$active) {$active=$_POST["active"];} +$park_ext=$_GET["park_ext"]; if (!$park_ext) {$park_ext=$_POST["park_ext"];} +$park_file_name=$_GET["park_file_name"]; if (!$park_file_name) {$park_file_name=$_POST["park_file_name"];} +$web_form_address=$_GET["web_form_address"]; if (!$web_form_address) {$web_form_address=$_POST["web_form_address"];} +$allow_closers=$_GET["allow_closers"]; if (!$allow_closers) {$allow_closers=$_POST["allow_closers"];} +$hopper_level=$_GET["hopper_level"]; if (!$hopper_level) {$hopper_level=$_POST["hopper_level"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$next_agent_call=$_GET["next_agent_call"]; if (!$next_agent_call) {$next_agent_call=$_POST["next_agent_call"];} +$local_call_time=$_GET["local_call_time"]; if (!$local_call_time) {$local_call_time=$_POST["local_call_time"];} +$voicemail_ext=$_GET["voicemail_ext"]; if (!$voicemail_ext) {$voicemail_ext=$_POST["voicemail_ext"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$list_name=$_GET["list_name"]; if (!$list_name) {$list_name=$_POST["list_name"];} +$group_id=$_GET["group_id"]; if (!$group_id) {$group_id=$_POST["group_id"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$group_color=$_GET["group_color"]; if (!$group_color) {$group_color=$_POST["group_color"];} +$fronter_display=$_GET["fronter_display"]; if (!$fronter_display) {$fronter_display=$_POST["fronter_display"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$dial_status_a=$_GET["dial_status_a"]; if (!$dial_status_a) {$dial_status_a=$_POST["dial_status_a"];} +$dial_status_b=$_GET["dial_status_b"]; if (!$dial_status_b) {$dial_status_b=$_POST["dial_status_b"];} +$dial_status_c=$_GET["dial_status_c"]; if (!$dial_status_c) {$dial_status_c=$_POST["dial_status_c"];} +$dial_status_d=$_GET["dial_status_d"]; if (!$dial_status_d) {$dial_status_d=$_POST["dial_status_d"];} +$dial_status_e=$_GET["dial_status_e"]; if (!$dial_status_e) {$dial_status_e=$_POST["dial_status_e"];} +$lead_order=$_GET["lead_order"]; if (!$lead_order) {$lead_order=$_POST["lead_order"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$campaign_vdad_exten=$_GET["campaign_vdad_exten"]; if (!$campaign_vdad_exten) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +$campaign_rec_exten=$_GET["campaign_rec_exten"]; if (!$campaign_rec_exten) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +$campaign_recording=$_GET["campaign_recording"]; if (!$campaign_recording) {$campaign_recording=$_POST["campaign_recording"];} +$campaign_rec_filename=$_GET["campaign_rec_filename"]; if (!$campaign_rec_filename) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +$hotkey=$_GET["hotkey"]; if (!$hotkey) {$hotkey=$_POST["hotkey"];} +$reset_list=$_GET["reset_list"]; if (!$reset_list) {$reset_list=$_POST["reset_list"];} +$old_campaign_id=$_GET["old_campaign_id"]; if (!$old_campaign_id) {$old_campaign_id=$_POST["old_campaign_id"];} +$OLDuser_group=$_GET["OLDuser_group"]; if (!$OLDuser_group) {$OLDuser_group=$_POST["OLDuser_group"];} +$status_name=$_GET["status_name"]; if (!$status_name) {$status_name=$_POST["status_name"];} +$selectable=$_GET["selectable"]; if (!$selectable) {$selectable=$_POST["selectable"];} +$HKstatus=$_GET["HKstatus"]; if (!$HKstatus) {$HKstatus=$_POST["HKstatus"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} +$delete_users=$_GET["delete_users"]; if (!$delete_users) {$delete_users=$_POST["delete_users"];} +$delete_user_groups=$_GET["delete_user_groups"]; if (!$delete_user_groups) {$delete_user_groups=$_POST["delete_user_groups"];} +$delete_lists=$_GET["delete_lists"]; if (!$delete_lists) {$delete_lists=$_POST["delete_lists"];} +$delete_campaigns=$_GET["delete_campaigns"]; if (!$delete_campaigns) {$delete_campaigns=$_POST["delete_campaigns"];} +$delete_ingroups=$_GET["delete_ingroups"]; if (!$delete_ingroups) {$delete_ingroups=$_POST["delete_ingroups"];} +$delete_remote_agents=$_GET["delete_remote_agents"]; if (!$delete_remote_agents) {$delete_remote_agents=$_POST["delete_remote_agents"];} +$load_leads=$_GET["load_leads"]; if (!$load_leads) {$load_leads=$_POST["load_leads"];} +$campaign_detail=$_GET["campaign_detail"]; if (!$campaign_detail) {$campaign_detail=$_POST["campaign_detail"];} +$ast_admin_access=$_GET["ast_admin_access"]; if (!$ast_admin_access) {$ast_admin_access=$_POST["ast_admin_access"];} +$ast_delete_phones=$_GET["ast_delete_phones"]; if (!$ast_delete_phones) {$ast_delete_phones=$_POST["ast_delete_phones"];} +$CoNfIrM=$_GET["CoNfIrM"]; if (!$CoNfIrM) {$CoNfIrM=$_POST["CoNfIrM"];} +$delete_scripts=$_GET["delete_scripts"]; if (!$delete_scripts) {$delete_scripts=$_POST["delete_scripts"];} +$script_id=$_GET["script_id"]; if (!$script_id) {$script_id=$_POST["script_id"];} + $script_id = strtoupper($script_id); +$script_name=$_GET["script_name"]; if (!$script_name) {$script_name=$_POST["script_name"];} +$script_comments=$_GET["script_comments"]; if (!$script_comments) {$script_comments=$_POST["script_comments"];} +$script_text=$_GET["script_text"]; if (!$script_text) {$script_text=$_POST["script_text"];} +$reset_hopper=$_GET["reset_hopper"]; if (!$reset_hopper) {$reset_hopper=$_POST["reset_hopper"];} +$get_call_launch=$_GET["get_call_launch"]; if (!$get_call_launch) {$get_call_launch=$_POST["get_call_launch"];} +$am_message_exten=$_GET["am_message_exten"]; if (!$am_message_exten) {$am_message_exten=$_POST["am_message_exten"];} +$amd_send_to_vmx=$_GET["amd_send_to_vmx"]; if (!$amd_send_to_vmx) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"]; if (!$xferconf_a_dtmf) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +$xferconf_a_number=$_GET["xferconf_a_number"]; if (!$xferconf_a_number) {$xferconf_a_number=$_POST["xferconf_a_number"];} +$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"]; if (!$xferconf_b_dtmf) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +$xferconf_b_number=$_GET["xferconf_b_number"]; if (!$xferconf_b_number) {$xferconf_b_number=$_POST["xferconf_b_number"];} +$modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST["modify_leads"];} +$hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} +$change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} +$agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} + + + + +### AST GUI database administration +### admin.php +### +### CHANGES +### 50315-1110 - Added Custom Campaign Statuses +### 50317-1438 - Added Fronter Display var to inbound groups +### 50322-1355 - Added custom callerID per campaign +### 50517-1356 - Added user_groups sections and user_group to vicidial_users +### 50517-1440 - Added ability to logout (must click OK with empty user/pass) +### 50602-1622 - Added lead loader pages to load new files into vicidial_list +### 50620-1351 - Added custom vdad transfer AGI extension per campaign +### 50810-1414 - modified in groups to kick out spaces and dashes +### 50908-2136 - Added Custom Campaign HotKeys +### 50914-0950 - Fixed user search by user_group +### 50926-1358 - Modified to allow for language translation +### 50926-1615 - Added WeBRooTWritablE write controls +### 51020-1008 - Added editable web address and park ext - NEW dial campaigns +### 51020-1056 - Added fields and help for campaign recording control +### 51123-1335 - Altered code to function in php globals=off +### 51208-1038 - Added user_level changes, function controls and default user phones +### 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +### 51213-1706 - Added add/delete/modify vicidial scripts +### 51214-1737 - Added preview of vicidial script in popup window +### 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +### 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +### 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +### 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +### 60204-0659 - Fixed hopper reset bug +### 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +### 60213-1100 - Added several vicidial_users permissions fields +### 60215-1319 - Added On-hold CallBacks display and links +### 60227-1226 - Fixed vicidial_inbound_groups insert bug + +### 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 + +$version = '1.1.10-5'; +$build = '60227-1226'; + +$STARTtime = date("U"); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha salido. Gracias\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGdelete_scripts =$row[18]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if ($ADD==1) {echo "Añadir un Usuario";} +if ($ADD==11) {echo "Añadir una Campaña";} +if ($ADD==111) {echo "Añadir una Lista";} +if ($ADD==1111) {echo "Añadir un Grupo-Entrantes";} +if ($ADD==11111) {echo "Añadir Agentes Remotos";} +if ($ADD==111111) {echo "Añadir un Usuarios Group";} +if ($ADD==1111111) {echo "Agregue La Nueva Escritura";} +if ($ADD==2) {echo "Nueva Adición De Usuario";} +if ($ADD==21) {echo "Nueva Adición De la Campaña";} +if ($ADD==22) {echo "Nueva Adición Del Estado De la Campaña";} +if ($ADD==23) {echo "Nueva Adición De Tecla De Acceso Directo De la Campaña";} +if ($ADD==211) {echo "Nueva Adición De la Lista";} +if ($ADD==2111) {echo "Nueva Adición Del Grupo de Entrantes";} +if ($ADD==21111) {echo "Nueva Adición de Agentes Remotos";} +if ($ADD==211111) {echo "Nueva Adición Del Grupo De Usuarios";} +if ($ADD==2111111) {echo "Nueva Adición De la Escritura";} +if ($ADD==3) {echo "Modificar Usuario";} +if ($ADD==31) {echo "Modifcar Campaña";} +if ($ADD==34) {echo "Modificar Campaña - Vista Básica";} +if ($ADD==311) {echo "Modificar Lista";} +if ($ADD==3111) {echo "Modificar In-Group";} +if ($ADD==31111) {echo "Modificar Agentes Remotos";} +if ($ADD==311111) {echo "Modificar Usuarios Groups";} +if ($ADD==3111111) {echo "Modifique La Escritura";} +if ($ADD=="4A") {echo "Modificar Usuario - Admin";} +if ($ADD==4) {echo "Modificar Usuario";} +if ($ADD==41) {echo "Modifcar Campaña";} +if ($ADD==42) {echo "Modifcar Campaña Status";} +if ($ADD==43) {echo "Modifcar Campaña HotKey";} +if ($ADD==44) {echo "Modificar Campaña - Vista Básica";} +if ($ADD==411) {echo "Modificar Lista";} +if ($ADD==4111) {echo "Modificar In-Group";} +if ($ADD==41111) {echo "Modificar Agentes Remotos";} +if ($ADD==411111) {echo "Modificar Usuarios Groups";} +if ($ADD==4111111) {echo "Modifique La Escritura";} +if ($ADD==5) {echo "Delete User";} +if ($ADD==51) {echo "Delete Campaign";} +if ($ADD==52) {echo "Agentes Del Registro de estado de la máquina";} +if ($ADD==511) {echo "Delete List";} +if ($ADD==5111) {echo "Delete In-Group";} +if ($ADD==51111) {echo "Suprima los agentes alejados";} +if ($ADD==511111) {echo "Usuarios de la cancelación Group";} +if ($ADD==5111111) {echo "Escritura De la Cancelación";} +if ($ADD==6) {echo "Delete User";} +if ($ADD==61) {echo "Delete Campaign";} +if ($ADD==62) {echo "Agentes Del Registro de estado de la máquina";} +if ($ADD==611) {echo "Delete List";} +if ($ADD==6111) {echo "Delete In-Group";} +if ($ADD==61111) {echo "Suprima los agentes alejados";} +if ($ADD==611111) {echo "Usuarios de la cancelación Group";} +if ($ADD==6111111) {echo "Escritura De la Cancelación";} +if ($ADD==7111111) {echo "Escritura De la Inspección previo";} +if ($ADD==0) {echo "Bienvenido";} +if ($ADD==8) {echo "Servicios repetidos Dentro Del Agente";} +if ($ADD==81) {echo "Servicios repetidos Dentro De la Campaña";} +if ($ADD==811) {echo "Servicios repetidos Dentro De la Lista";} +if ($ADD==10) {echo "Campañas";} +if ($ADD==100) {echo "Listas";} +if ($ADD==1000) {echo "In-Groups";} +if ($ADD==10000) {echo "Agentes Remotos";} +if ($ADD==100000) {echo "Grupos De Usuario";} +if ($ADD==1000000) {echo "Escrituras";} +if ($ADD==55) {echo "Formulario De Búsqueda";} +if ($ADD==66) {echo "RESULTADOS DE LA BÚSQUEDA";} +if ($ADD==99999) {echo "AYUDA";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rsltx=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rsltx); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or ($ADD=="4A") ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<100) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"AYUDA\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: AYUDA


\n"; + +?> +VICIDIAL_USERS TABLA

+ +
+Identificación del usuario - este campo es donde usted pone el número de la identificación del usuario de VICIDIAL, puede ser hasta 8 dígitos en longitud, debe ser por lo menos 2 caracteres en longitud. + +
+
+
+Contraseña - este campo es donde usted pone la contraseña de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud. + +
+
+
+Nombre completo - este campo es donde usted pone el nombre completo de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud. + +
+
+
+Nivel de usuario - este menú es donde usted selecciona el nivel de usuario de los usuarios de VICIDIAL. Debe ser un nivel de 1 a registrar en VICIDIAL, debe ser llano mayor de 2 a abrirse una sesión como más cercano, deben ser el nivel de usuario 8 o mayor conseguir en la sección de la tela del admin. + +
+
+
+Grupo de usuario - este menú es donde usted selecciona a grupo de usuarios de VICIDIAL que este usuario pertenecerá a. Esto no tiene ninguna restricciones en este tiempo, éste es justo subdividir a usuarios y permitir las características futuras basadas sobre él. + +
+
+
+Conexión del teléfono - aquí es para donde usted puede fijar un valor de la conexión del teléfono del defecto cuando los registros del usuario en vicidial.php. Este valor poblará el phone_login automáticamente cuando el usuario entra con su usuario-pasar-campaña en la pantalla de la conexión de vicidial.php. + +
+
+
+Paso del teléfono - aquí es para donde usted puede fijar un valor del paso del teléfono del defecto cuando los registros del usuario en vicidial.php. Este valor poblará los phone_pass automáticamente cuando el usuario entra con su usuario-pasar-campaña en la pantalla de la conexión de vicidial.php. + +
+
+
+Usuarios de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima a otros usuarios del igual o de poco nivel de usuario del sistema. + +
+
+
+Suprima a grupos de usuario - esta opción si el sistema a 1 permite que el usuario suprima a grupos de usuario del sistema. + +
+
+
+La cancelación enumera - esta opción si el sistema a 1 permite que el usuario suprima listas vicidial del sistema. + +
+
+
+La cancelación hace campaña - esta opción si el sistema a 1 permite que el usuario suprima campañas vicidial del sistema. + +
+
+
+En-Grupos de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima a En-Grupos vicidial del sistema. + +
+
+
+Suprima los agentes alejados - esta opción si el sistema a 1 permite que el usuario suprima agentes alejados vicidial del sistema. + +
+
+
+La carga conduce - esta opción si el sistema a 1 permite que el usuario cargue los plomos vicidial en la tabla del vicidial_list por el cargador basado tela del plomo. + +
+
+
+Detalle de la campaña - esta opción si el sistema a 1 permite que el usuario visión y modifique los elementos de la pantalla del detalle de la campaña. + +
+
+
+Acceso de AGC Admin - esta opción si el sistema a 1 permite a usuario a la conexión a las páginas astGUIclient del admin. + +
+
+
+La cancelación de AGC telefona - esta opción si el sistema a 1 permite que el usuario suprima entradas del teléfono en las páginas astGUIclient del admin. + +
+
+
+Escrituras de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima las escrituras de la campaña en la pantalla de la modificación de la escritura. + +
+
+
+Modifique los plomos - esta opción si el sistema a 1 permite que el usuario modifique los plomos en la página de los resultados de la búsqueda del plomo de la sección del admin. + +
+
+
+HotKeys activo - esta opción si el sistema a 1 permite que el usuario utilice la función ra'pida-dispositioning de HotKeys adentro vicidial.php. + +
+
+
+Cambie la campaña del agente - esta opción si el sistema a 1 permite que el usuario altere la campaña que un agente está registrado en mientras que se registran en él. + +
+
+
+El agente elige Ingroups - esta opción si el sistema a 1 permite que el usuario elija los ingroups de los cuales recibirán llamadas cuando ellos conexión a una campaña MÃS CERCANA o DE ENTRADA. Si no el encargado necesitará fijar esto en su pantalla del detalle del usuario de la página del admin. + +
+
+
+Grupos de entrada - aquí es donde usted selecciona a grupos de entrada que usted desea recibir llamadas de si usted ha seleccionado la campaña MÃS CERCANA. + + + +



+ +VICIDIAL_CAMPAIGNS TABLA

+
+
+Identificación de la campaña - Úste es el nombre corto de la campaña, él no es editable después de la sumisión inicial, no puede contener espacios y debe estar entre 2 y 8 caracteres en longitudh. + +
+
+
+Nombre de la campaña - Ésta es la descripción de la campaña, debe estar entre 6 y 40 caracteres en longitud. + +
+
+
+Activo - aquí es adonde usted fija la campaña a activo o a inactivo. Si es inactivo, noone puede registrar en él. + +
+
+
+Extensión del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que la extensión esté en lugar en el extensions.conf y eso que señala al nombre de fichero abajo. + +
+
+
+Nombre del archivo del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que el nombre de fichero sea 10 caracteres en longitud o menos y que el archivo está en lugar en el directorio de /var/lib/asterisk/sounds. + +
+
+
+Forma del Web - aquí es donde usted puede fijar el Web page de encargo que será abierto cuando el usuario chasca encendido el botón de la FORMA del WEB. + +
+
+
+Permita Closers - aquí es donde usted puede fijar si los usuarios de esta campaña tendrán la opción para enviar la llamada a un más cercano. + +
+
+
+Estado del dial - aquí es adonde usted fija los estados que usted está deseando marcar encendido dentro de las listas que son activas para la campaña abajo + +
+
+
+Orden de la lista - Este menú es donde usted selecciona cómo los plomos que emparejan los estados seleccionados arriba serán puestos en la tolva del plomo: +
  - DOWN: seleccione los primeros plomos cargados en la tabla del vicidial_list +
  - UP: seleccione los plomos pasados cargados en la tabla del vicidial_list +
  - UP PHONE: seleccione el número y los trabajos más altos de teléfono su manera abajo +
  - DOWN PHONE: seleccione el número y los trabajos más bajos de teléfono su manera para arriba +
  - UP LAST NAME: comienzo con los nombres pasados comenzando con Z y trabajos su manera abajo +
  - DOWN LAST NAME: comienzo con los nombres pasados comenzando con A y trabajos su manera para arriba +
  - UP COUNT: comienzo con los plomos y los trabajos llamados su manera abajo +
  - DOWN COUNT: comienzo con menos plomos y trabajos llamados su manera para arriba +
  - DOWN COUNT 2nd NEW: comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada otro lead(Must para no tener NEW seleccionado en los estados del dial) +
  - DOWN COUNT 3nd NEW: comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada tercer lead(Must para no tener NEW seleccionado en los estados del dial) +
  - DOWN COUNT 4th NEW: comienzo con menos plomos y trabajos llamados que su manera para arriba que inserta un NEW plomo en cada adelante conduzca (no debe tener NEW seleccionado en los estados del dial) + +
+
+
+Tolva llana - éste es cuántos conducen los intentos de la escritura de VDhopper para mantener la tabla del vicidial_hopper para esta campaña. Si funciona la escritura de VDhopper cada minuto, haga esto levemente mayor que el número de plomos que usted entra a través en un minuto. + +
+
+
+Reajuste de la fuerza de la tolva - esto permite que usted limpie fuera del contenido de la tolva sobre la sumisión de la forma. Debe ser llenada otra vez cuando la escritura de VDhopper funciona. + +
+
+
+Nivel auto del dial - aquí es adonde usted fija cuántos alinea VICIDIAL debe utilizar por medios del agente activo cero 0 que el marcar del automóvil está apagado y los agentes chascarán para marcar cada número. Si no VICIDIAL mantendrá líneas que marcan iguales a los agentes activos multiplicados por el nivel del dial para llegar cuántas líneas debe permitir esta campaña en cada servidor. + +
+
+
+Llamada siguiente del agente - esto se determina qué agente recibe la llamada siguiente que está disponible: +
  - random: órdenes por el valor al azar de la actualización en la tabla de los vicidial_live_agents +
  - oldest_call_start: las órdenes por la vez última un agente fueron enviadas una llamada. Resultados en los agentes que reciben el número casi igual de llamadas cabalmente. +
  - oldest_call_finish: las órdenes por la vez última un agente acabaron una llamada. El agente de AKA que espera lo más de largo posible recibe la primera llamada. +
  - overall_user_level: las órdenes por el user_level del agente según lo definido en los vicidial_users tabulan un user_level más alto recibirán más llamadas. + +
+
+
+Tiempo de la llamada local - aquí es adonde usted fijó durante qué horas usted quisiera marcar, según lo determinado por el tiempo local en está en cuál usted está llamando. Esto es controlada por código de área y ajustada por tiempo de los ahorros de la luz del día si es aplicable. Las pautas generales en los E.E.U.U. para el negocio al negocio son los 9am a los 5pm y el negocio a las llamadas del consumidor es los 9am a los 9pm. + +
+
+
+Buzón de Voz - si estuvieron definidas, las llamadas que CAERÃAN normalmente en lugar de otro serían ordenadas a esta caja del voicemail para oír y para dejar un mensaje. + +
+
+
+Descanso del dial - si está definido, llamadas que normalmente retraso después de que el descanso definido en extensions.conf en lugar de otro descanso en esta cantidad de segundos si es menos que el descanso de extensions.conf. Esto permite descansos del dial rápidamente que cambian del servidor al servidor y a limitar los efectos a una sola campaña. Si usted está teniendo muchos de llamadas del contestador automático o de Buzón de Voz usted puede desear intentar cambiar este valor entre a 21-26 y ver si los resultados mejoran. + +
+
+
+Prefijo del dial - este campo permite más fácilmente cambiar una trayectoria de marcar a salir con un diverso método sin hacer una recarga en asterisco. El defecto es 9 basados sobre un 91NXXNXXXXXX en el dialplan - extensions.conf. + +
+
+
+Campaña CallerID - este campo permite enviar de un número de encargo del callerid en las llamadas de salida. Úste es el número que demostraría para arriba en el callerid de la persona que usted está llamando. El defecto es DESCONOCIDO. Esta opción está solamente disponible si usted está utilizando PRIs - ISDN T1 o E1 - que tienen la característica de encargo del callerid se giraron. Esta característica puede también trabajar con los troncos IAX2 dependiendo de lo que admite su abastecedor. El callerID de encargo se aplica solamente a las llamadas puestas para la campaña de VICIDIAL directamente, cualquier tercer persona llama o las transferencias no enviarán el callerID de encargo. NOTA: A veces el poner DESCONOCIDO o PRIVADO en el campo rendirá enviar de su número del callerID del defecto por su portador con las llamadas. Usted puede desear probar esto y poner 0000000000 en el campo del callerid en lugar de otro si usted no desea enviarle CallerID. + +
+
+
+Extensión de la campaña VDAD - este campo permite una extensión de la transferencia del costumbre VDAD. Esto permite que usted utilice diversas escrituras del agi de VDADtransfer... dependiendo de su campaña. La transferencia AGI(exten 8365 agi-VDADtransfer.agi del defecto) apenas envía inmediatamente invita a los agentes tan pronto como él se tome. Una encuesta sobre política AGI la muestra adicional es también (8366 agi-VDADtransferSURVEY.agi ) ese ahora incluido los juegos un mensaje a la persona llamada y permite que él haga una opción presionando buttons(effectively la pre-investigacio'n el plomo). Observe por favor eso a excepción de los exámenes, llamadas políticas y las caridades esta forma de llamar son ilegales en los Estados Unidos. + +
+
+
+Extensión de Rec de la Campaña - este campo permite para que una extensión de encargo de la grabación sea utilizada con VICIDIAL. Esto permite que usted utilice diversas extensiones dependiendo sobre cuánto tiempo usted desea permitir una grabación máxima y qué tipo de codec usted desea registrar adentro. El defecto exten es 8309 que si usted sigue los ejemplos de SCRATCH_INSTALL registrarán en el formato de WAV para hasta que una hora. Otra opción incluida en los ejemplos es 8310 que registrarán en el formato del GSM para hasta que una hora. + +
+
+
+Grabación de la campaña - este menú permite que usted elija qué nivel de la grabación se permite en esta campaña. NEVER inhabilitará la grabación en el cliente. ONDEMAND es el defecto y permite que el agente comience y pare a registrar según lo necesitado. ALLCALLS comenzará la grabación en el cliente siempre que una llamada se envíe a un agente. + +
+
+
+Nombre de fichero de Rec de la campaña - este campo permite que usted modifique el nombre para requisitos particulares de la grabación cuando la grabación de la campaña es ONDEMAND o ALLCALLS. Las variables permitidas son CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. El defecto es FULLDATE_AGENT y parecería este 20051020-103108_6666. Otro ejemplo es CAMPAIGN_TINYDATE_CUSTPHONE que parecería este TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Escritura de la campaña - este menú permite que usted elija la escritura que aparecerá en la pantalla de los agentes para esta campaña. No seleccione NONE no demostrar ninguna escritura para esta campaña. + +
+
+
+Consiga el lanzamiento de la llamada - este menú permite que usted elija si usted desee automo'vil-lance la página en una ventana separada, auto-switch de la tela-forma a la lengüeta de la ESCRITURA o no haga nada cuando una llamada se envía al agente para esta campaña. + +
+
+
+Mensaje del contestador automático - este campo está para entrar en una extensión para cegar llamadas de la transferencia a cuando el agente consigue un contestador automático y chasca encendido el botón del mensaje del contestador automático en el marco de la conferencia de la transferencia. Usted debe fijar esto exten para arriba en el dialplan - extensions.conf - y se cerciora de que juega un archivo audio después que cuelga para arriba. + +
+
+
+AMD envían a la VM exten - este menú permite que usted defina si un mensaje esté dejado en un contestador automático cuando se detecta la llamada será remitido inmediatamente a la extensión del Contestar-Ma'quina-Mensaje si AMD es activo y se determina que la llamada es un contestador automático. + +
+
+
+Xfer-Conf DTMF - Estos cuatro campos permiten para que usted tenga dos sistemas de conferencia de la transferencia y de precolocaciones de DTMF. Cuando se carga la llamada o la campaña, la escritura de vicidial.php demostrará dos botones en el marco de la transferir-conferencia y automo'vil-poblara' el nu'mero-a-dial y los campos del enviar-dtmf cuando está presionada. + + + +



+ +VICIDIAL_LISTS TABLA

+
+
+Identificación de la lista - Úste es el nombre numérico de la lista, él no es editable después de la sumisión inicial, debe contener solamente números y debe estar entre 2 y 8 caracteres en longitud. + +
+
+
+Nombre de la lista - Ésta es la descripción de la lista, debe estar entre 2 y 20 caracteres en longitud. + +
+
+
+Campaña - Ésta es la campaña que esta lista pertenece a. Una lista se puede marcar solamente en una sola campaña contemporáneamente. + +
+
+
+Activo - esto define si la lista debe ser marcada encendido o no. + +
+
+
+Reajuste el Conducir-Llamar-Estado para esta lista - esto reajusta todos los plomos en esta lista a N para "no llamado puesto que reajuste pasado" y significa que cualquier plomo puede ahora ser llamado si es el estado derecho según lo definido en la pantalla de la campaña. + + +



+ +VICIDIAL_INBOUND_GROUPS TABLA

+
+
+Identificación de grupo - Úste es el nombre corto del grupo de entrada, él no es editable después de la sumisión inicial, no debe contener cualquier espacio y debe estar entre 2 y 20 caracteres en longitud. + +
+
+
+Nombre de grupo - Ésta es la descripción del grupo, debe estar entre 2 y 30 caracteres en longitud. No puede incluir rociadas -, plusses + o espacios . + +
+
+
+Color del grupo - éste es el color que exhibe en el cliente app de VICIDIAL cuando una llamada viene adentro en este grupo. Debe estar entre 2 y 7 caracteres de largo. Si esto es una definición del color de la tuerca hexagonal usted debe recordar poner a # al principio de la secuencia o VICIDIAL no trabajará correctamente. + +
+
+
+Activo - esto se determina si este grupo demuestra para arriba en la caja de la selección cuando un agente de VICIDIAL entra. + +
+
+
+Forma del Web - Ésta es la dirección de encargo que el chascar en el botón de la FORMA del WEB en VICIDIAL le llevará para las llamadas que vienen adentro en este grupo. + +
+
+
+Buzón de Voz - si está definida, Ésta es la caja de Buzón de Voz que las llamadas irán en vez a ser caído si no hay agentes disponibles después del tiempo de asimiento están para arriba. + +
+
+
+Llamada siguiente del agente - esto se determina qué agente recibe la llamada siguiente que está disponible: +
  - random: órdenes por el valor al azar de la actualización en la tabla de los vicidial_live_agents +
  - oldest_call_start: las órdenes por la vez última un agente fueron enviadas una llamada. Resultados en los agentes que reciben el número casi igual de llamadas cabalmente. +
  - oldest_call_finish: las órdenes por la vez última un agente acabaron una llamada. El agente de AKA que espera lo más de largo posible recibe la primera llamada. +
  - overall_user_level: las órdenes por el user_level del agente según lo definido en los vicidial_users tabulan un user_level más alto recibirán más llamadas. + +
+
+
+Exhibición de Fronter - este campo se determina si el agente de entrada de VICIDIAL tendría el name(if del fronter allí es uno) exhibido en el campo del estado cuando la llamada viene al agente. + +
+
+
+Escritura de la campaña - este menú permite que usted elija la escritura que aparecerá en la pantalla de los agentes para esta campaña. No seleccione NONE no demostrar ninguna escritura para esta campaña. + +
+
+
+Consiga el lanzamiento de la llamada - este menú permite que usted elija si usted desee automo'vil-lance la página en una ventana separada, auto-switch de la tela-forma a la lengüeta de la ESCRITURA o no haga nada cuando una llamada se envía al agente para esta campaña. + +
+
+
+Xfer-Conf DTMF - Estos cuatro campos permiten para que usted tenga dos sistemas de conferencia de la transferencia y de precolocaciones de DTMF. Cuando se carga la llamada o la campaña, la escritura de vicidial.php demostrará dos botones en el marco de la transferir-conferencia y automo'vil-poblara' el nu'mero-a-dial y los campos del enviar-dtmf cuando está presionada. + + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLA

+
+
+Comienzo de la identificación del usuario - Ésta es la identificación del usuario que comienza se utiliza que cuando las entradas alejadas del agente se insertan en el sistema. Si el número de líneas se fija más altamente de 1, este número es incrementado por uno hasta que cada línea tiene una entrada. Se cerciora de usted crear una nueva cuenta del usuario de VICIDIAL con un nivel de usuario de 4 o grande si usted quisiera que pudieran utilizar la página de vdremote.php para el acceso alejado de la tela de esta cuenta. + +
+
+
+Número de líneas - el define cuánto crea el agente alejado las entradas el sistema, y se determina cuántas líneas piensa que puede enviar con seguridad al número debajo. + +
+
+
+IP del servidor - Una entrada alejada del agente es solamente buena para un servidor específico, aquí es donde usted selecciona a que el servidor usted desea. + +
+
+
+Extensión externa - éste es el número que usted desea las llamadas remitidas a. Cerciórese de que sea un número dialplan completo y que si usted necesita 9 al principio usted lo pone adentro aquí. Pruebe marcando este número de un teléfono en el sistema. + +
+
+
+Estado - aquí es donde usted da vuelta al agente alejado por intervalos. Tan pronto como el agente sea activo el sistema asume que puede enviarle llamadas. Puede tomar hasta 30 segundos una vez que usted cambie el estado a inactivo para parar el recibir de llamadas. + +
+
+
+Campaña - aquí es donde usted selecciona la campaña que estos agentes alejados serán registrados en. Necesidades de entrada de utilizar la campaña MÃS CERCANA y de seleccionar las campañas de entrada debajo de ésa que usted desea recibir llamadas de. + +
+
+
+Grupos de entrada - aquí es donde usted selecciona a grupos de entrada que usted desea recibir llamadas de si usted ha seleccionado la campaña MÃS CERCANA. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+Las listas dentro de esta campaña se enumeran aquí, si son activas son denotadas por la Y o N y usted pueden ir a la pantalla de la lista chascando en la identificación de la lista en la primera columna. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLA

+
+
+Con el uso de los estados de encargo de la campaña, usted puede tener estados que existan solamente para una campaña específica. El estado debe ser 1-8 caracteres en longitud, la descripción debe ser 2-30 caracteres en longitud y seleccionable define si demuestra para arriba en VICIDIAL como disposición. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLA

+
+
+Con el uso de los hotkeys de encargo de la campaña, los agentes que utilizan el retraso vicidial de la lata del tela-cliente y la disposición llama apenas presionando una sola llave en su teclado. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLA

+
+
+Grupo de usuario - éste es el nombre corto de un grupo de usuario de Vicidial, intento para no utilizar ningunos espacios o puntuación para los caracteres de este máximo 20 del campo, mínimo de 2 caracteres. + +
+
+
+Nombre de grupo - Ésta es la descripción del máximo vicidial del grupo de usuario de 40 caracteres. + + + + + +



+ +VICIDIAL_SCRIPTS TABLA

+
+
+Identificación de la escritura - Éste es el nombre corto de una escritura de Vicidial. Éste necesita ser un identificador único. Intente no utilizar ningunos espacios o puntuación para los caracteres de este máximo 10 del campo, mínimo de 2 caracteres. + +
+
+Nombre de la escritura - éste es el título de una escritura de Vicidial. Éste es un resumen corto de los caracteres del máximo 50 de la escritura, mínimo de 2 caracteres. No debe haber espacios o puntuación de la clase en campo de los theis. + +
+
+Comentarios de la escritura - éste es tal como donde usted puede poner los comentarios para una escritura de Vicidial - cambiantes para liberar mejora de sept. el 23 -. caracteres del máximo 255, mínimo de 2 caracteres. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today? + +
+
+
+Activo - esto se determina si esta escritura se puede seleccionar para ser utilizado por una campaña. + + + + + +



+ +FUNCIONALIDAD DEL CARGADOR DE LA LISTA DE VICIDIAL

+
+
+El VICIDIAL tela-baso' cargador del plomo se diseña simplemente llevar un file(up del plomo 8MB de tamaño) que es lengüeta o pipa delimitada y cargarlo en la tabla del vicidial_list. Hay también un cargador estupendo nuevo del plomo de la versión beta que permite para el campo que elige y de TXT- el texto claramente, los valores separados coma de CSV- y XLS- sobresalen formatos del archivo. El cargador del plomo no hace la validación de datos o la comprobación para duplicados en sí mismo u otras listas, de modo que esté algo usted necesita hacer antes de usted la carga los plomos. También, cerciórese de que usted haya creado la lista que estos plomos son estar debajo de modo que usted pueda utilizarlos. Hay también la materia de la tiempo-zona-codificacio'n estos plomos. Usted puede desear aumentar la frecuencia que el ADMIN_adjust_GMTnow_on_leads.pl se está funcionando en el cron en su servidor del asterisco para poder cifrar cualquier plomo cargado más rápidamente. Aquí está una lista de los campos en su orden apropiada para los archivos del plomo: +
    +
  1. Código del plomo del vendedor - demuestra para arriba en el campo de la identificación del vendedor del GUI +
  2. Código de fuente - uso interno solamente para los admins y DBAs +
  3. Identificación de la lista - el número de la lista que estos plomos demostrarán para arriba debajo +
  4. Código del teléfono - el prefijo para el teléfono number(1 para los E.E.U.U., 01144 para Reino Unido, 01161 para AUS, el etc) +
  5. Número de teléfono - debe ser por lo menos 8 dígitos de largo +
  6. Título - título del customer(Mr. Ms señ., etc...) +
  7. Nombre +
  8. Inicial Media +
  9. Apellidos +
  10. Dirección, línea 1 +
  11. Dirección, línea 2 +
  12. Dirección, línea 3 +
  13. Ciudad +
  14. Estado - limitado a 2 caracteres +
  15. Provincia +
  16. Código Postal +
  17. País +
  18. Sexo +
  19. Fecha de nacimiento +
  20. Número De Teléfono Alternativo +
  21. Dirección Email +
  22. Frase De Seguridad +
  23. Comentarios +
+ +
NOTAS: La funcionalidad del cargador del plomo del sobresalir es permitida por una serie de escrituras del Perl y necesita tener un archivo correctamente configurado de /home/cron/AST_SERVER_conf.pl en lugar en el web server. También, los módulos de un Perl de los pares se deben cargar para ella para trabajar también - oLE-Storage_Lite-Storage_Lite y la Hoja de balance-ParseExcel. Usted puede comprobar para saber si hay errores runtime en éstos mirando su archivo del error_log de apache. + +







+







+EL EXTREMO +
+\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Escritura De la Inspección previo: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + + +?> + + + + +\n"; +echo "English \n";echo "Español \n";echo "Ελληνικά \n";?> +
+ + + + + + + +
  VICIDIAL ADMIN - Salir  
  MOSTRAR USUARIOS | NUEVO USUARIO | BUSCAR UN USUARIO |               |NUEVO GRUPO DE USUARIO | MOSTRAR GRUPOS DE USUARIO
  NUEVA CAMPAÑA | MOSTRAR CAMPAÑAS |              | MOSTRAR LISTAS | NUEVA LISTA |               | CARGAR LEADS
  MOSTRAR IN-GROUPS | NUEVO IN-GROUP |               | MOSTRAR LOS AGENTES REMOTOS | NUEVO AGENTE REMOTO
  STATS AND REPORTS               | AGREGUE LA ESCRITURA | ESCRITURAS DE LA VISIÓN |             | BÚSCAR UN LEAD | GRUPO POR HORA
+"; + +echo "
NUEVO USUARIO
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "$NWB#vicidial_users-user_group$NWE\n"; +echo "\n"; +echo "
NÚmero De Usuario: $NWB#vicidial_users-user$NWE
Contraseña: $NWB#vicidial_users-pass$NWE
Nombre Completo: $NWB#vicidial_users-full_name$NWE
Nivel Del Usuario: $NWB#vicidial_users-user_level$NWE
Grupo Del Usuario:
Conexión Del Teléfono: $NWB#vicidial_users-phone_login$NWE
Contraseña Del Teléfono: $NWB#vicidial_users-phone_pass$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
NUEVA CAMPAÑA\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID De la Campaña: $NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: $NWB#vicidial_campaigns-park_ext$NWE
Nombre de fichero Del Parking: $NWB#vicidial_campaigns-park_file_name$NWE
Formulario Web: $NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Llamar al Siguiente Agente: $NWB#vicidial_campaigns-next_agent_call$NWE
Franja horaria de llamada: $NWB#vicidial_campaigns-local_call_time$NWE
Buzón de Voz: $NWB#vicidial_campaigns-voicemail_ext$NWE
Escritura: $NWB#vicidial_campaigns-campaign_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID De la Lista: (Solamente dígitos)$NWB#vicidial_lists-list_id$NWE
Nombre De la Lista: $NWB#vicidial_lists-list_name$NWE
Campaña: $NWB#vicidial_lists-campaign_id$NWE
Activo: $NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
NUEVO GRUPO DE ENTRADA\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID De Grupo: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Nombre De Grupo: $NWB#vicidial_inbound_groups-group_name$NWE
Color Del Grupo: $NWB#vicidial_inbound_groups-group_color$NWE
Activo: $NWB#vicidial_inbound_groups-active$NWE
Formulario Web: $NWB#vicidial_inbound_groups-web_form_address$NWE
Buzón de Voz: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Llamar al Siguiente Agente: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Mostrar Fronter: $NWB#vicidial_inbound_groups-fronter_display$NWE
Escritura: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
NUEVO AGENTE REMOTO\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: (Solamente números, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Número de líneas: (Solamente números)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Del Servidor: $NWB#vicidial_remote_agents-server_ip$NWE
Extensión Externa: (número del dialplan para alcanzar agentes)$NWB#vicidial_remote_agents-conf_exten$NWE
Estado: $NWB#vicidial_remote_agents-status$NWE
Campaña: $NWB#vicidial_remote_agents-campaign_id$NWE
Grupos De entrada: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
NUEVO GRUPO DE USUARIOS\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Grupo: (sin espacios o signos de puntuación)$NWB#vicidial_user_groups-user_group$NWE
Descripción: (Descripción del grupo)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ +echo ""; + +echo "
ADD NEW SCRIPT\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Script ID: (sin espacios o signos de puntuación)$NWB#vicidial_scripts-script_id$NWE
Script Name: (título de la escritura)$NWB#vicidial_scripts-script_name$NWE
Script Comentarios: $NWB#vicidial_scripts-script_comments$NWE
Activo: $NWB#vicidial_scripts-active$NWE
Script Text: $NWB#vicidial_scripts-script_text$NWE
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USUARIO NO AGREGADO - hay ya un usuario en el sistema con este número del usuario\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID del usuario debe estar entre 2 y 8 caracteres de largo\n"; + echo "
el nombre completo y la contraseña deben ser por lo menos 2 caracteres de largo\n"; + } + else + { + echo "
EL USUARIOAÑADIDO: $user\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');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAÚA NO AGREGADA - hay ya una campaña en el sistema con esta identificación\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAÚA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña debe estar entre 2 y 8 caracteres en longitud\n"; + echo "
el nombre de la campaña debe estar entre 6 y 40 caracteres en longitud\n"; + } + else + { + echo "
CAMPAÑA AÑADIDA: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch')|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO de la CAMPAÚA - hay ya una campaña - estado NO AGREGADO en el sistema con este nombre\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO de la CAMPAÚA NO AGREGADO - hay ya un global-estado en el sistema con este nombre\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ESTADO de la CAMPAÚA NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 8 caracteres en longitud\n"; + echo "
el nombre del estado debe estar entre 2 y 30 caracteres en longitud\n"; + } + else + { + echo "
ESTADO DE LA CAMPAÑA AÑADIDA: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } + } +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAÚA HOTKEY NO AGREGADA - hay ya una campaña-hotkey en el sistema con este hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAÚA HOTKEY NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el hotkey debe ser un solo carácter entre 1 y 9 \n"; + echo "
el estado debe estar entre 1 y 8 caracteres en longitud\n"; + } + else + { + echo "
ACCESO DIRECTO A LA CAMPAÑA AÑADIDO: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA HOTKEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LISTA NO AGREGADA - hay ya una lista en el sistema con esta ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
LISTA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La ID de la lista debe estar entre 2 y 8 caracteres en longitud\n"; + echo "
El nombre de la lista debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
LISTA AÑADIDA: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPO NO AGREGADO - hay ya un grupo en el sistema con esta ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GRUPO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La ID de grupo debe estar entre 2 y 20 caracteres en longitud y contener no ' -+'.\n"; + echo "
El color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPO AÑADIDO: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch'|\n"); + fclose($fp); + } + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AGENTES ALEJADOS NO AGREGADOS - hay ya una entrada alejada de los agentes comenzando con esta ID del usuario\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
AGENTES ALEJADOS NO AGREGADOS - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
AGENTES REMOTO AÑADIDO: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPO de USUARIO NO AGREGADO - hay ya una entrada del grupo de usuario con este nombre\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GRUPO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GRUPO AÑADIDO: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVO USUARIO GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESCRITURA NO AGREGADA - hay ya una entrada de la escritura con este nombre\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ESCRITURA NO AGREGADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre, la descripción y el texto de la escritura deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
ESCRITURA AGREGADA: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|'$script_id','$script_name','$script_comments','$script_text','$active'|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
USUARIO MODIFICADO - ADMIN: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|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' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
USUARIO MODIFICADO: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud\n"; + } + else + { + echo "
CAMPAÑA MODIFICADA: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
REAJUSTE DE LA TOLVA DEL PLOMO DE LA CAMPAÚA\n"; + echo "
- Espera 1 minuto antes de marcar el número siguiente\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO de la CAMPAÚA NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña necesita ser por lo menos 2 caracteres en longitud\n"; + echo "
el estado de la campaña necesita ser por lo menos los caracteres 1 en longitud\n"; + } + else + { + echo "
ESTADO DE ENCARGO DE LA CAMPAÚA SUPRIMIDO: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAÚA HOTKEY NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña necesita ser por lo menos 2 caracteres en longitud\n"; + echo "
el estado de la campaña necesita ser por lo menos los caracteres 1 en longitud\n"; + echo "
el hotkey de la campaña necesita ser por lo menos los caracteres 1 en longitud\n"; + } + else + { + echo "
LA CAMPAÚA DE ENCARGO HOTKEY SUPRIMIÚ: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud\n"; + } + else + { + echo "
CAMPAÑA MODIFICADA: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
REAJUSTE DE LA TOLVA DEL PLOMO DE LA CAMPAÚA\n"; + echo "
- Espera 1 minuto antes de marcar el número siguiente\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LISTA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la lista debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
LISTA MODIFICADA: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
REAJUSTANDO LA LISTA - LLAMADA - ESTADO\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + } + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GRUPO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
GRUPO MODIFICADO: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id'|\n"); + fclose($fp); + } + } + +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
AGENTES ALEJADOS NO MODIFICADOS - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
LOS AGENTES ALEJADOS SE MODIFICARON\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GRUPO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GRUPO MODIFICADO\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + } + } + +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ESCRITURA NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre, la descripción y el texto de la escritura deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
LA ESCRITURA SE MODIFICÓ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id'|\n"); + fclose($fp); + } + } + +$ADD=3111111; # go to script modification form below +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL USUARIO: $user\n"; + echo "

Chasque aquí para suprimir a usuario $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAÑA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA CAMPAÑA: $campaign_id\n"; + echo "

Chasque aquí para suprimir campaña $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTES NO REGISTRADOS FUERA DE CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DEL REGISTRO DE ESTADO DE LA MÃQUINA DEL AGENTE: $campaign_id\n"; + echo "

Chasque aquí para registrar todos los agentes fuera de $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LISTA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA LISTA: $list_id\n"; + echo "

Chasque aquí para suprimir la lista y todos sus plomos $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
EN-GRUPO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE EN-GRUPO: $group_id\n"; + echo "

Chasque aquí para suprimir a en-grupo $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
AGENTE ALEJADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN ALEJADA DE LA CANCELADURA DEL AGENTE: $remote_agent_id\n"; + echo "

Chasque aquí para suprimir el agente alejado $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
GRUPO DE USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL GRUPO DE USUARIO: $user_group\n"; + echo "

Chasque aquí para suprimir a usuario group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
ESCRITURA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA ESCRITURA: $user_group\n"; + echo "

Chasque aquí para suprimir la escritura $script_id


\n"; + } + +$ADD='3111111'; # go to user group modification below +} + + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|user='$user'|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL USUARIO TERMINADA: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAÑA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DE LA CAMPAÑA TERMINÓ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents fro a campaign +###################### + +if ($ADD==62) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTES NO REGISTRADOS FUERA DE CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
EL REGISTRO DE ESTADO DE LA MÃQUINA DEL AGENTE TERMINÓ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='31'; # go to campaign modification below +} +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LISTA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA LISTA DE LA TABLA DE VICIDIAL_LIST\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DE LA LISTA TERMINÓ: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
EN-GRUPO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DE EN-GRUPO TERMINADA: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
AGENTE ALEJADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA ALEJADA DEL AGENTE TERMINADA: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
GRUPO DE USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL GRUPO DE USUARIO TERMINADA: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
ESCRITURA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DE LA ESCRITURA TERMINADA: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to user group list +} + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + +if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
Usted no tiene permisos de modificar a este usuario: $row[1]\n"; + } +else + { + echo "
MODIFIQUE Un EXPEDIENTE De los USUARIOS: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + {echo "\n";} + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level > 8) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
NÚmero De Usuario: $row[1]$NWB#vicidial_users-user$NWE
Contraseña: $NWB#vicidial_users-pass$NWE
Nombre Completo: $NWB#vicidial_users-full_name$NWE
Nivel Del Usuario: $NWB#vicidial_users-user_level$NWE
Grupo Del Usuario: $NWB#vicidial_users-user_group$NWE
Conexión Del Teléfono: $NWB#vicidial_users-phone_login$NWE
Contraseña Del Teléfono: $NWB#vicidial_users-phone_pass$NWE
El Agente Elige Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
HotKeys Activo: $NWB#vicidial_users-hotkeys_active$NWE
Usuarios de la cancelación: $NWB#vicidial_users-delete_users$NWE
Suprima a grupos de usuario: $NWB#vicidial_users-delete_user_groups$NWE
La cancelación enumera: $NWB#vicidial_users-delete_lists$NWE
La cancelación hace campaña: $NWB#vicidial_users-delete_campaigns$NWE
En-Grupos de la cancelación: $NWB#vicidial_users-delete_ingroups$NWE
Suprima los agentes alejados: $NWB#vicidial_users-delete_remote_agents$NWE
Escritura De la Cancelacións: $NWB#vicidial_users-delete_scripts$NWE
La carga conduce: $NWB#vicidial_users-load_leads$NWE
Detalle de la campaña: $NWB#vicidial_users-campaign_detail$NWE
Acceso de AGC Admin: $NWB#vicidial_users-ast_admin_access$NWE
La cancelación de AGC telefona: $NWB#vicidial_users-ast_delete_phones$NWE
Modifique Los Plomos: $NWB#vicidial_users-modify_leads$NWE
Cambie La Campaña Del Agente: $NWB#vicidial_users-change_agent_campaign$NWE
Grupos De entrada: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_users-closer_campaigns$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

SUPRIMA A ESTE USUARIO\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Clique aquí para ver las estadísticas del usuario\n"; + echo "

Click here for user CallBack Holds\n"; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + +echo "
MODIFIQUE Un EXPEDIENTE De las CAMPAÚAS: $row[0] - Vista Básica | Vista Detallada\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
ID De la Campaña: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Formulario Web: $NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Estado del dial 1: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 2: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 3: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 4: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 5: $NWB#vicidial_campaigns-dial_status$NWE
Orden De la Lista: $NWB#vicidial_campaigns-lead_order$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Forzar el Reinicio del Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Llamar al Siguiente Agente: $NWB#vicidial_campaigns-next_agent_call$NWE
Franja horaria de llamada: $NWB#vicidial_campaigns-local_call_time$NWE
Buzón de Voz: $NWB#vicidial_campaigns-voicemail_ext$NWE
Tiempo de espera Del Dial: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Prefijo al marcar: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
CallerID de la Campaña: $NWB#vicidial_campaigns-campaign_cid$NWE
Exten VDAD de La campaña: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Extensión de Rec de la campaña: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Grabación De la Campaña: $NWB#vicidial_campaigns-campaign_recording$NWE
Nombre de fichero De Rec De la Campaña: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Escritura: $NWB#vicidial_campaigns-campaign_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_campaigns-get_call_launch$NWE
Mensaje del contestador automático: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD envían a la VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfiera -Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
LISTAS DENTRO DE ESTA CAMPAÑA:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ID DE LA LISTANOMBRE DE LA LISTAACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Esta campaña tiene $active_lists listas activas y $inactive_lists listas inactivas

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "Esta campaña tiene $active_leads Leads para ser llamados en estas listas

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "Esta campaña tiene $hopper_leads Leads en el Hopper

\n"; +echo "Chasque aquí para ver qué plomos están en la tolva ahora

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
ESTADOS DE ENCARGO DENTRO DE ESTA CAMPAÚA:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ESTADODESCRIPCIÓNSELECCIONABLEELIMINAR
$rowx[0]$rowx[1]$rowx[2]ELIMINAR
\n"; + +echo "
AGREGAR ESTADO PERSONALIZADO A LA CAMPAÑA
\n"; +echo "\n"; +echo "\n"; +echo "Estado:   \n"; +echo "Descripción:   \n"; +echo "Seleccionable:   \n"; +echo "
\n"; + +echo "

\n"; + + + +echo "
PERSONALIZAR ACCEDOS DIRECTOS PARA ESTA CAMPAÑA:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ACCESO DIRECTOESTADODESCRIPCIÓNELIMINAR
$rowx[1]$rowx[0]$rowx[2]ELIMINAR
\n"; + +echo "
AÑADIR ACCESO DIRECTO A LA CAMPAÑA
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Acceso Directo:   \n"; +echo "Estado:   \n"; +echo "
\n"; + +echo "

\n"; + +echo "REGISTRE TODOS LOS AGENTES FUERA DE ESTA CAMPAÑA

\n"; + +if ($LOGdelete_campaigns > 0) + { + echo "

SUPRIMA ESTA CAMPAÑA\n"; + } + +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ($ADD==34) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Vista Básica | Vista Detallada
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
ID De la Campaña: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Formulario Web: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Estado del dial 1: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 2: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 3: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 4: $NWB#vicidial_campaigns-dial_status$NWE
Estado del dial 5: $NWB#vicidial_campaigns-dial_status$NWE
Orden De la Lista: $NWB#vicidial_campaigns-lead_order$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Forzar el Reinicio del Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Escritura: $script_id
Consiga El Lanzamiento De la Llamada: $get_call_launch
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + +echo "
\n"; +echo "
LISTAS DENTRO DE ESTA CAMPAÑA:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
ID DE LA LISTANOMBRE DE LA LISTAACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "Esta campaña tiene $active_lists listas activas y $inactive_lists listas inactivas

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "Esta campaña tiene $active_leads Leads para ser llamados en estas listas

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "Esta campaña tiene $hopper_leads Leads en el Hopper

\n"; +echo "Chasque aquí para ver qué plomos están en la tolva ahora

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + +echo "
\n"; + +echo "REGISTRE TODOS LOS AGENTES FUERA DE ESTA CAMPAÑA

\n"; + + +if ($LOGdelete_campaigns > 0) + { + echo "

SUPRIMA ESTA CAMPAÑA\n"; + } + + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
MODIFICAR UN REGISTRO DE LAS LISTAS: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID De la Lista: $row[0]$NWB#vicidial_lists-list_id$NWE
Nombre De la Lista: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Activo: $NWB#vicidial_lists-active$NWE
Reiniciar el Lead-Called-Status para esta lista: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
ESTADOS DENTRO DE ESTA LISTA:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[0] == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
ESTADOLLAMADONO LLAMADO
$CLB$rowx[0]$CLE $rowx[2]
$CLB$rowx[0]$CLE$rowx[2]
SUBTOTALES$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
ZONAS DE TIEMPO DENTRO DE ESTA LISTA:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
DESPLAZAMIENTO GMT AHORA (tiempo local)LLAMADONO LLAMADO
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
SUBTOTALES$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
LLAMADAS REALIZADAS DENTRO DE ESTA LISTA:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
ESTADO$firstSUBTOTAL
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +if ($LOGdelete_lists > 0) + { + echo "

SUPRIMA ESTA LISTA\n"; + } + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + +echo "
MODIFICAR UN REGISTRO DE LOS GRUPOS: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + + +echo "\n"; +echo "
ID De Grupo: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Nombre De Grupo: $NWB#vicidial_inbound_groups-group_name$NWE
Color Del Grupo: $NWB#vicidial_inbound_groups-group_color$NWE
Activo: $NWB#vicidial_inbound_groups-active$NWE
Formulario Web: $NWB#vicidial_inbound_groups-web_form_address$NWE
Buzón de Voz: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Llamar al Siguiente Agente: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Mostrar Fronter: $NWB#vicidial_inbound_groups-fronter_display$NWE
Escritura: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfiera -Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +if ($LOGdelete_ingroups > 0) + { + echo "

SUPRIMA A ESTE EN-GRUPO\n"; + } + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: (Solamente números, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Número de líneas: (Solamente números)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Del Servidor: $NWB#vicidial_remote_agents-server_ip$NWE
Extensión Externa: (número del dialplan para alcanzar agentes)$NWB#vicidial_remote_agents-conf_exten$NWE
Estado: $NWB#vicidial_remote_agents-status$NWE
Campaña: $NWB#vicidial_remote_agents-campaign_id$NWE
Grupos De entrada: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + + +if ($LOGdelete_remote_agents > 0) + { + echo "

SUPRIMA ESTE AGENTE ALEJADO\n"; + } + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
MODIFICAR UNA ENTRADA EN LOS GRUPOS DE USUARIOS\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Grupo: (sin espacios o signos de puntuación)$NWB#vicidial_user_groups-user_group$NWE
Descripción: (Descripción del grupo)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +if ($LOGdelete_user_groups > 0) + { + echo "

SUPRIMA A ESTE USUARIO GROUP\n"; + } + +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; +echo ""; + +echo "
MODIFIQUE Una ESCRITURA\n"; +echo "\n"; +echo "\n"; +echo "Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Name: (título de la escritura)$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Comentarios: $NWB#vicidial_scripts-script_comments$NWE\n"; +echo "Activo: $NWB#vicidial_scripts-active$NWE\n"; +echo "Script Text:

Escritura De la Inspección previo $NWB#vicidial_scripts-script_text$NWE\n"; +echo "\n"; +echo "
\n"; + +if ($LOGdelete_scripts > 0) + { + echo "

SUPRIMA ESTA ESCRITURA\n"; + } + +} + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
BUSCAR UN USUARIO\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
NÚmero De Usuario:
Nombre Completo:
Nivel Del Usuario:
Grupo Del Usuario:
\n"; + +} + +###################### +# ADD=66 user search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
RESULTADOS DE LA BÚSQUEDA:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFICAR | ESTADÃSTICAS | ESTADO | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and user='$user' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and campaign_id='$campaign_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and list_id='$list_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ +echo "
\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTCAMPAIGNENTRY FECHACALLBACK FECHAUSERRECIPIENT
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]
\n"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USUARIOS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFICAR | ESTADÃSTICAS | ESTADO | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAÑAS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFICAR
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LISTAS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFICAR
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
GRUPOS DE ENTRADA :\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFICAR
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
AGENTES REMOTOS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFICAR
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
GRUPOS DE USUARIO :\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFICAR
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFICAR
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/admin_modify_lead.php b/LANG_admin/LANG_admin/vicidial_es/admin_modify_lead.php new file mode 100644 index 0000000..5e1e2d6 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/admin_modify_lead.php @@ -0,0 +1,321 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ENVIAR=$_GET["ENVIAR"]; if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];} + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Registro del Lead modificado + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Información modificada

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Información de la llamada: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     ID De la Lista: $list_id
Nombre:   \n"; + echo " Apellidos:
Dirección 1 :
Dirección 2 :
Dirección 3 :
Ciudad :
Estado:   \n"; + echo " Código Postal:
Provincia :
País :
Alt Phone :
Email :
Seguridad:
Comentarios :
Disposición:
\n"; + echo "


\n"; + + } + else + { + echo "las operaciones de búsqueda del plomo FALLARON para el lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "LLAMADAS A ESTE LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where lead_id='$lead_id' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS TSR CAMPAÑA LIST LEAD
$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
\n"; + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/admin_search_lead.php b/LANG_admin/LANG_admin/vicidial_es/admin_search_lead.php new file mode 100644 index 0000000..f365e64 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/admin_search_lead.php @@ -0,0 +1,185 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ENVIAR=$_GET["ENVIAR"]; if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];} + +### AST GUI database administration search for lead info +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Buscar Lead + +Operaciones de búsqueda del Lead + + + +
\n"; + echo "
\n"; + echo "Por favor, Introduzca un:
Vendor ID(código del vendedor del Lead): or \n"; + echo "
un número de teléfono de casa: or\n"; + echo "
ID del Lead:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='$vendor_id'"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='$phone'"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if (eregi('10.10.10.2',$ip)) + { + echo "\n\n$stmt\n\n"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($row[0]) < 3) && (strlen($row[1]) < 3) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "Las variables de la búsqueda que usted incorporó no son activas en el sistema

\n"; + echo "Va por favor detrás y dobla el cheque la información que usted incorporó y somete otra vez\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "\n
\n\n";
+		echo "lead ID: $row[0]\n";
+		echo "status: $row[3]\n";
+		echo "vendor_id: $row[5]\n";
+		echo "last rep called: $row[4]\n";
+		echo "list_id: $row[7]\n";
+		echo "phone: $row[11]\n";
+		echo "Name: $row[13] $row[15]\n";
+		echo "Ciudad: $row[19]\n";
+		echo "Security: $row[28]\n";
+		echo "Comentarios: $row[29]\n\n";
+		echo "\n";
+		echo "
\n"; + + # https://www.vicimarketing.com/internal/back_end_sys/uk_cust_serv/index.php?person_id=$row[7]&people_packages_id=&secure_lvl=2&display=2&username=$username&passwd=$passwd + + echo "Chasque aquí para ver los detalles del plomo\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNUEVA BÚSQUEDA"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/count.htm b/LANG_admin/LANG_admin/vicidial_es/count.htm new file mode 100644 index 0000000..51f8a36 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/count.htm @@ -0,0 +1 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_es/dbconnect.php b/LANG_admin/LANG_admin/vicidial_es/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_admin/LANG_admin/vicidial_es/group_hourly_stats.php b/LANG_admin/LANG_admin/vicidial_es/group_hourly_stats.php new file mode 100644 index 0000000..e341139 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/group_hourly_stats.php @@ -0,0 +1,227 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Stats Cada hora Del Grupo + + +
+ + + + + += '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_no_hour 00:00:00' and call_date <= '$date_no_hour 23:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
  VICIDIAL ADMIN: Stats Cada hora Del Grupo  
\n"; + +echo "
\n"; + +echo "CUENTAS DE HORAS DE TSR: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   LLAMADAS TOTALES   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFICAR | ESTADÃSTICAS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Inscriba por favor a grupo que usted desea conseguir el stats cada hora para:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/help.gif b/LANG_admin/LANG_admin/vicidial_es/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/LANG_admin/LANG_admin/vicidial_es/help.gif differ diff --git a/LANG_admin/LANG_admin/vicidial_es/htglobalize.php b/LANG_admin/LANG_admin/vicidial_es/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/listloader.php b/LANG_admin/LANG_admin/vicidial_es/listloader.php new file mode 100644 index 0000000..0d65623 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/listloader.php @@ -0,0 +1,187 @@ +\"AYUDA\""; + +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + +
Cargar Leads de este archivo:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("./vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Procesando$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: El archivo excede el límite 8MB.
"; +} +?> + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/listloaderMAIN.php b/LANG_admin/LANG_admin/vicidial_es/listloaderMAIN.php new file mode 100644 index 0000000..d4f6fa4 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/listloaderMAIN.php @@ -0,0 +1,69 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + +VICIDIAL: Módulo Cargador de Leads + + + + + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/new_listloader_superL.php b/LANG_admin/LANG_admin/vicidial_es/new_listloader_superL.php new file mode 100644 index 0000000..3aff2a8 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/new_listloader_superL.php @@ -0,0 +1,747 @@ + 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"AYUDA\""; + +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Super Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + + + + + + + + + + + + + + + +
Cargar Leads de este archivo:
File layout to use:Standard VICIDIAL    Custom layout
        
CLICK HERE TO GO TO THE BASIC LEAD LOADER         BACK TO ADMIN
SUPER LIST LOADER-     VERSION:     BUILD:
+ + +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Procesando$delim_name-delimited file...\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + print "
ProcesandoExcel file... \n"; + # print "$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"; + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ProcesandoCSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Procesando$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + passthru("$WeBServeRRooT/vicidial/listloader.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ProcesandoCSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $tbl_rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Procesando$delim_name-delimited file...\n"; + + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
ProcesandoCSV file... \n"; + + $total=0; $good=0; $bad=0; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: El archivo excede el límite 8MB.
"; +} +?> + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/remote_dispo.php b/LANG_admin/LANG_admin/vicidial_es/remote_dispo.php new file mode 100644 index 0000000..f9c82d8 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/remote_dispo.php @@ -0,0 +1,279 @@ + 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +REMOTE VICIDIAL: Disposición De la Llamada + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='$call_length', status='$status', user='$PHP_AUTH_USER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments',user='$PHP_AUTH_USER' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "La llamada ha sido dispositioned       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Información de la llamada: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     ID De la Campaña: $campaign_id
Fronter: $tsr     ID De la Lista: $list_id
Nombre:   \n"; + echo " Apellidos:
Dirección 1 :
Dirección 2 :
Dirección 3 :
Ciudad :
Estado:   \n"; + echo " Código Postal:
Provincia :
País :
Alt Phone :
Email :
Seguridad:
Comentarios :
Disposición:
\n"; + echo "


\n"; + + } + else + { + echo "las operaciones de búsqueda del plomo FALLARON para el lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/server_stats.php b/LANG_admin/LANG_admin/vicidial_es/server_stats.php new file mode 100644 index 0000000..f56618c --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/server_stats.php @@ -0,0 +1,70 @@ + + + + + + +VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports + +

VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPCIÓNIP ADDRESSACTIVOVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/LANG_admin/LANG_admin/vicidial_es/user_stats.php b/LANG_admin/LANG_admin/vicidial_es/user_stats.php new file mode 100644 index 0000000..4db1bb3 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/user_stats.php @@ -0,0 +1,302 @@ + 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats + + +
+ + + + + +\n"; +echo "
  VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TIEMPO Y ESTADO DE CONVERSACIÓN:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
ESTADOCUENTAHORAS:MINUTOS
$row[1] $row[0] $call_hours_int:$call_minutes_int
LLAMADAS TOTALES $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "TIEMPO LOGIN/LOGOUT:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='$user' and event_date >= '$begin_date 0:00:01' and event_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENTO FECHA CAMPAÑAHORAS:MINUTOS
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "ÚLTIMAS 50 LLAMADAS:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='$user' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS PHONE CAMPAÑA LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/user_status.php b/LANG_admin/LANG_admin/vicidial_es/user_status.php new file mode 100644 index 0000000..d2770ac --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/user_status.php @@ -0,0 +1,223 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ENVIAR=$_GET["ENVIAR"]; if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + $stmt="SELECT * from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status + + +
+
+ + + + +\n"; +echo "
  VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='$group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaña: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name - \n"; + +echo "VICIDIAL Time Sheet\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/LANG_admin/LANG_admin/vicidial_es/vdremote.php b/LANG_admin/LANG_admin/vicidial_es/vdremote.php new file mode 100644 index 0000000..765b921 --- /dev/null +++ b/LANG_admin/LANG_admin/vicidial_es/vdremote.php @@ -0,0 +1,584 @@ +0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha salido. Gracias\n"; + exit; +} + + +$popup_page = './closer_popup.php'; +$version = '1.1.9'; +$build = '51123-1502'; +$STARTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL, AGENTES REMOTOS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modificar Agentes Remotos";} +if ($ADD==41111) {echo "Modificar Agentes Remotos";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL, AGENTES REMOTOS:   Salir  
  MODIFICAR | ">ESTADO | ">ESTADÃSTICAS DE ENTRADA
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: $user_start
Número de líneas: (Solamente números)
IP Del Servidor: $row[3]
Extensión Externa: (number dialed to reach agents [i.e. 913125551212])
Estado:
Campaña: $campaign_id
Grupos De entrada: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
AGENTES ALEJADOS NO MODIFICADOS - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
LOS AGENTES ALEJADOS SE MODIFICARON\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: $user_start
Número de líneas: (Solamente números)
IP Del Servidor: $row[3]
Extensión Externa: (number dialed to reach agents [i.e. 913125551212])
Estado:
Campaña: $campaign_id
Grupos De entrada: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]='- ESPERANDO -'; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agentes identificados en el servidor $server_ip\n\n"; + + echo " - Llamadas de 5 minutos o más\n"; + echo " - Sobre 10 minutos en llamada\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************AGENTES SIN LLAMADAS*********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Stats de entrada del agente alejado $NOW_TIME\n\n"; + echo "\n"; + echo "Llamadas totales tomadas $query_date: $in_calls\n"; + echo "Tiempo total de conversación$query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Lista la llamada para $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agentes identificados en el servidor $server_ip\n\n"; + + # echo " - Llamadas de 5 minutos o más\n"; + # echo " - Sobre 10 minutos en llamada\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************NINGUNA LLAMADA PARA HOY*******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/LANG_agc.zip b/LANG_agc.zip new file mode 100644 index 0000000..59366ea Binary files /dev/null and b/LANG_agc.zip differ diff --git a/LANG_agc/LANG_agc/agc/active_list_refresh.php b/LANG_agc/LANG_agc/agc/active_list_refresh.php new file mode 100644 index 0000000..301e5ed --- /dev/null +++ b/LANG_agc/LANG_agc/agc/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "List Display: "; +if ($ADD==1) {echo "Live Extensions";} +if ($ADD==2) {echo "Busy Extensions";} +if ($ADD==3) {echo "Outside Lines";} +if ($ADD==4) {echo "Local Extensions";} +if ($ADD==5) {echo "Conferences";} +if ($ADD==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc/astguiclient.php b/LANG_agc/LANG_agc/agc/astguiclient.php new file mode 100644 index 0000000..5b1da59 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc/call_log_display.php b/LANG_agc/LANG_agc/agc/call_log_display.php new file mode 100644 index 0000000..7918756 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/conf_exten_check.php b/LANG_agc/LANG_agc/agc/conf_exten_check.php new file mode 100644 index 0000000..671d29b --- /dev/null +++ b/LANG_agc/LANG_agc/agc/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/dbconnect.php b/LANG_agc/LANG_agc/agc/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK.gif new file mode 100644 index 0000000..30703a7 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK_e.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK_e.gif new file mode 100644 index 0000000..600cef8 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_BLINK_e.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF.gif new file mode 100644 index 0000000..5b7e4c7 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF_es.gif new file mode 100644 index 0000000..ec9c1d5 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON.gif new file mode 100644 index 0000000..ad55916 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON_es.gif b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON_es.gif new file mode 100644 index 0000000..442a808 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_check_voicemail_ON_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF.gif b/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF.gif new file mode 100644 index 0000000..3752fb5 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF_es.gif new file mode 100644 index 0000000..1ff376d Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_live_call_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_live_call_ON.gif b/LANG_agc/LANG_agc/agc/images/agc_live_call_ON.gif new file mode 100644 index 0000000..ed8ba2d Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_live_call_ON.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_live_call_ON_es.gif b/LANG_agc/LANG_agc/agc/images/agc_live_call_ON_es.gif new file mode 100644 index 0000000..041d398 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_live_call_ON_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines.gif new file mode 100644 index 0000000..9f8eaf6 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines_es.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines_es.gif new file mode 100644 index 0000000..bdefd01 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_active_lines_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_astguiclient.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_astguiclient.gif new file mode 100644 index 0000000..3037357 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_astguiclient.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_conferences.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_conferences.gif new file mode 100644 index 0000000..e3c8066 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_conferences.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_conferences_es.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_conferences_es.gif new file mode 100644 index 0000000..14ab717 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_conferences_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_main.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_main.gif new file mode 100644 index 0000000..6e687e4 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_main.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/agc_tab_main_es.gif b/LANG_agc/LANG_agc/agc/images/agc_tab_main_es.gif new file mode 100644 index 0000000..b5fc2a5 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/agc_tab_main_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/blank.gif b/LANG_agc/LANG_agc/agc/images/blank.gif new file mode 100644 index 0000000..3a46969 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/blank.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/de.gif b/LANG_agc/LANG_agc/agc/images/de.gif new file mode 100644 index 0000000..4dd34f6 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/de.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/down.gif b/LANG_agc/LANG_agc/agc/images/down.gif new file mode 100644 index 0000000..32d0a00 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/down.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/el.gif b/LANG_agc/LANG_agc/agc/images/el.gif new file mode 100644 index 0000000..9e79d8b Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/el.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/en.gif b/LANG_agc/LANG_agc/agc/images/en.gif new file mode 100644 index 0000000..cb45f5f Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/en.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/es.gif b/LANG_agc/LANG_agc/agc/images/es.gif new file mode 100644 index 0000000..308ea3c Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/fr.gif b/LANG_agc/LANG_agc/agc/images/fr.gif new file mode 100644 index 0000000..21fb3d1 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/fr.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/it.gif b/LANG_agc/LANG_agc/agc/images/it.gif new file mode 100644 index 0000000..6c7b179 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/it.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/pt.gif b/LANG_agc/LANG_agc/agc/images/pt.gif new file mode 100644 index 0000000..646b76a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/pt.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/remove.gif b/LANG_agc/LANG_agc/agc/images/remove.gif new file mode 100644 index 0000000..89b0521 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/remove.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/up.gif b/LANG_agc/LANG_agc/agc/images/up.gif new file mode 100644 index 0000000..0d55544 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/up.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber.gif new file mode 100644 index 0000000..a5a080d Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF.gif new file mode 100644 index 0000000..75bc0e8 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF_es.gif new file mode 100644 index 0000000..405ff33 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_es.gif new file mode 100644 index 0000000..ca92716 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_dialnextnumber_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall.gif new file mode 100644 index 0000000..a677925 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF.gif new file mode 100644 index 0000000..74b1f5a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF_es.gif new file mode 100644 index 0000000..21991dd Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_es.gif new file mode 100644 index 0000000..9acc363 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_grabparkedcall_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer.gif new file mode 100644 index 0000000..b4fdfae Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF.gif new file mode 100644 index 0000000..e5736ae Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF_es.gif new file mode 100644 index 0000000..570a6e5 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_es.gif new file mode 100644 index 0000000..94d3e22 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_hangupcustomer_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall.gif new file mode 100644 index 0000000..88fee28 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF.gif new file mode 100644 index 0000000..8ad5501 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF_es.gif new file mode 100644 index 0000000..110ce6b Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_es.gif new file mode 100644 index 0000000..2274a27 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_parkcall_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_pause.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause.gif new file mode 100644 index 0000000..3486a1c Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF.gif new file mode 100644 index 0000000..fce0304 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF_es.gif new file mode 100644 index 0000000..494d68a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_es.gif new file mode 100644 index 0000000..544a379 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_pause_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_resume.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume.gif new file mode 100644 index 0000000..a7d75dd Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF.gif new file mode 100644 index 0000000..0ae4cb9 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF_es.gif new file mode 100644 index 0000000..921d5d5 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_es.gif new file mode 100644 index 0000000..1b09614 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_resume_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf.gif new file mode 100644 index 0000000..d19888a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF.gif new file mode 100644 index 0000000..08a4b39 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF_es.gif new file mode 100644 index 0000000..2d32c5e Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_es.gif new file mode 100644 index 0000000..43964df Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_senddtmf_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_spacer.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_spacer.gif new file mode 100644 index 0000000..d0a4f6e Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_spacer.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording.gif new file mode 100644 index 0000000..022103d Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF.gif new file mode 100644 index 0000000..3ee4ca6 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF_es.gif new file mode 100644 index 0000000..ff9a344 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_es.gif new file mode 100644 index 0000000..26420f7 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_startrecording_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording.gif new file mode 100644 index 0000000..6f3bfed Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF.gif new file mode 100644 index 0000000..2e1efe4 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF_es.gif new file mode 100644 index 0000000..2806311 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_es.gif new file mode 100644 index 0000000..94f9de9 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_stoprecording_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf.gif new file mode 100644 index 0000000..c573851 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF.gif new file mode 100644 index 0000000..dd0a579 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF_es.gif new file mode 100644 index 0000000..d0a54bf Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_es.gif new file mode 100644 index 0000000..10cfa49 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_transferconf_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_webform.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform.gif new file mode 100644 index 0000000..4d5228f Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF.gif new file mode 100644 index 0000000..64316ce Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF_es.gif new file mode 100644 index 0000000..75a5619 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_es.gif new file mode 100644 index 0000000..d7590d6 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_LB_webform_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage.gif new file mode 100644 index 0000000..484d01e Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage_OFF.gif new file mode 100644 index 0000000..3aa9480 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_ammessage_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer.gif new file mode 100644 index 0000000..77c03e0 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF.gif new file mode 100644 index 0000000..7fb481e Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF_es.gif new file mode 100644 index 0000000..05adaac Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_es.gif new file mode 100644 index 0000000..fdad633 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_blindtransfer_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_channel.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_channel.gif new file mode 100644 index 0000000..9a9ce7b Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_channel.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_channel_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_channel_es.gif new file mode 100644 index 0000000..a4fbf1f Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_channel_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_code.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_code.gif new file mode 100644 index 0000000..8fb2b8c Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_code.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer.gif new file mode 100644 index 0000000..68697ed Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF.gif new file mode 100644 index 0000000..8bf2e44 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif new file mode 100644 index 0000000..7ef98a9 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_es.gif new file mode 100644 index 0000000..d71bca1 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_dialwithcustomer_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines.gif new file mode 100644 index 0000000..4e6db07 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF.gif new file mode 100644 index 0000000..f1ffdc1 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF_es.gif new file mode 100644 index 0000000..8f12acc Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_es.gif new file mode 100644 index 0000000..646c876 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupbothlines_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline.gif new file mode 100644 index 0000000..d25a105 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF.gif new file mode 100644 index 0000000..a8fb4a3 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF_es.gif new file mode 100644 index 0000000..3c717d0 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_es.gif new file mode 100644 index 0000000..0d92a89 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hangupxferline_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_header.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_header.gif new file mode 100644 index 0000000..c813b9a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_header.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_header_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_header_es.gif new file mode 100644 index 0000000..a92c2df Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_header_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive.gif new file mode 100644 index 0000000..8382205 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF.gif new file mode 100644 index 0000000..3357ed2 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif new file mode 100644 index 0000000..638ef85 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es.gif new file mode 100644 index 0000000..5c9a312 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_es.gif new file mode 100644 index 0000000..b064725 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysactive_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysinactive_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysinactive_es.gif new file mode 100644 index 0000000..d0bf982 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_hotkeysinactive_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser.gif new file mode 100644 index 0000000..a1adca7 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF.gif new file mode 100644 index 0000000..9d3489f Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF_es.gif new file mode 100644 index 0000000..45bc429 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_es.gif new file mode 100644 index 0000000..d5c0565 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_internalcloser_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall.gif new file mode 100644 index 0000000..7bca06f Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF.gif new file mode 100644 index 0000000..63594d6 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF_es.gif new file mode 100644 index 0000000..9c41a29 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_es.gif new file mode 100644 index 0000000..9aa2970 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_leave3waycall_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser.gif new file mode 100644 index 0000000..0e10a2a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF.gif new file mode 100644 index 0000000..ed11b7a Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF_es.gif new file mode 100644 index 0000000..fbad052 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_es.gif new file mode 100644 index 0000000..d36e194 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_localcloser_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_number.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_number.gif new file mode 100644 index 0000000..33f3033 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_number.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_number_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_number_es.gif new file mode 100644 index 0000000..6d672ac Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_number_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial.gif new file mode 100644 index 0000000..195b1a9 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF.gif new file mode 100644 index 0000000..7c27573 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif new file mode 100644 index 0000000..ef710c9 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_es.gif new file mode 100644 index 0000000..accda01 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_parkcustomerdial_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds.gif new file mode 100644 index 0000000..92fc7f2 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds_es.gif new file mode 100644 index 0000000..f4fe2b2 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_XB_seconds_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_tab_script.gif b/LANG_agc/LANG_agc/agc/images/vdc_tab_script.gif new file mode 100644 index 0000000..69e43b7 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_tab_script.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_tab_script_es.gif b/LANG_agc/LANG_agc/agc/images/vdc_tab_script_es.gif new file mode 100644 index 0000000..ba4320d Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_tab_script_es.gif differ diff --git a/LANG_agc/LANG_agc/agc/images/vdc_tab_vicidial.gif b/LANG_agc/LANG_agc/agc/images/vdc_tab_vicidial.gif new file mode 100644 index 0000000..1e86258 Binary files /dev/null and b/LANG_agc/LANG_agc/agc/images/vdc_tab_vicidial.gif differ diff --git a/LANG_agc/LANG_agc/agc/inbound_popup.php b/LANG_agc/LANG_agc/agc/inbound_popup.php new file mode 100644 index 0000000..ec418bc --- /dev/null +++ b/LANG_agc/LANG_agc/agc/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/live_exten_check.php b/LANG_agc/LANG_agc/agc/live_exten_check.php new file mode 100644 index 0000000..7fdd573 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ChannelA[$loop_count] = "$row[0]"; + $ChannelB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $ChannelA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/manager_send.php b/LANG_agc/LANG_agc/agc/manager_send.php new file mode 100644 index 0000000..e6887a2 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc/park_calls_display.php b/LANG_agc/LANG_agc/agc/park_calls_display.php new file mode 100644 index 0000000..ce421f5 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/vdc_db_query.php b/LANG_agc/LANG_agc/agc/vdc_db_query.php new file mode 100644 index 0000000..7fbc2fd --- /dev/null +++ b/LANG_agc/LANG_agc/agc/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Invalid Username/Password: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc/vicidial.php b/LANG_agc/LANG_agc/agc/vicidial.php new file mode 100644 index 0000000..afafb6e --- /dev/null +++ b/LANG_agc/LANG_agc/agc/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICIDIALSCRIPT   LIVE     session ID: Live Call
+
+ + + + +

VICIDIAL
+
+ + + + +
+ + Transfer - Conference
+ INTERNAL CLOSER + LOCAL CLOSER + CODE + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + seconds   + channel + + OVERRIDE   + D1 + D2 +
+ + Dial With Customer + Park Customer Dial + LEAVE 3-WAY CALL + Dial Blind Transfer + Blind Transfer VMail Message +
+
+
+ + + + +
Lead Dispositioned As:

+ -
+
+
+ + + + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + +
Noone is in your session:
+ OK +
+
+ + +
Customer has hung up:
+ OK +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + +
DISPOSITION CALL :       minimize
+ End-of-call Disposition Selection +
+ STOP CALLING
+ RESET | + SUBMIT +



  +
+
+ + + +
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ + CB Comments:

+ + SUBMIT

+ + +

  +
+
+ + +
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + + + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ REFRESH


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + +
VICIDIAL SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ALT PHONE DIAL
";} + + +?> +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+Send DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments:
+ +
+


  + +
+ + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc/voicemail_check.php b/LANG_agc/LANG_agc/agc/voicemail_check.php new file mode 100644 index 0000000..eb01d84 --- /dev/null +++ b/LANG_agc/LANG_agc/agc/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/active_list_refresh.php b/LANG_agc/LANG_agc/agc_de/active_list_refresh.php new file mode 100644 index 0000000..27dba82 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Liste Anzeige: "; +if ($ADD==1) {echo "Phasenverlängerungen";} +if ($ADD==2) {echo "Beschäftigte Verlängerungen";} +if ($ADD==3) {echo "Äußere Linien";} +if ($ADD==4) {echo "Lokale Verlängerungen";} +if ($ADD==5) {echo "Konferenzen";} +if ($ADD==99999) {echo "HILFE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_de/astguiclient.php b/LANG_agc/LANG_agc/agc_de/astguiclient.php new file mode 100644 index 0000000..6e9b298 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Sie haben jetzt heraus geloggt. Danke\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: LOGON\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
LOGON
 
Benutzer-LOGON:
Benutzer-Kennwort:
Telefon-LOGON:
Telefon-Kennwort:

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIVORWAHLKNOPF|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIVORWAHLKNOPF|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Telefon-LOGON\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Telefon-LOGON
 
Telefon-LOGON:
Telefon-Kennwort:

VERSION: $version       BAU: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Telefon-LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Telefon-LOGON
 
Traurig, Ihr Telefon-LOGON und Kennwort seien Sie nicht in diesem:
 
Telefon-LOGON:
Telefon-Kennwort:

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
HauptverkleidungAktive Linien VerkleidungKonferenz-VerkleidungÜberprüfen Sie VoicemailLeben Anruf
+
+ + +

Logout
+
+ + +
TRUNK HÄNGEZUSTAND

+ Active Trunks Menu
+ Hängezustand-Stamm   |   + Straßenräuber-Stamm   |   + Hören Stamm   |   + ErneuernSie   |   + Zurück zu Hauptfenster +
+
+ + +
LOKALER HÄNGEZUSTAND

+ Aktives Lokales Menü
+ Hängezustand-Einheimischer   |   + Straßenräuber-Einheimischer   |   + Hören Einheimischer   |   + ErneuernSie   |   + Zurück zu Hauptfenster +
+
+ + + + + + + +
PHASENANRUF-ÜBERTRAGUNG
Gebracht zu werden Führung: Führung
Verlängerungen:
Verlängerungen Menü
+
+ Senden Sie zu vorgewählter Verlängerung

+ Senden Sie zu vorgewähltem vmail Kasten

+ Senden Sie zu dieser Zahl:


+ ErneuernSie


+ Zurück zu Hauptfenster

+
Konferenzen:
(klicken Sie an eine Zahl unten, um zu einer Konferenz zu senden)
Senden Sie meine Führung auch
Konferenz-Menü
+
+ + + + + +
LOKALER Verlängerungen Vorwahlknopf
Telefon, das von benennt: Führung
Verlängerungen:
Verlängerungen Menü
+
+ Anruf vorgewählte Verlängerung

+ Anruf vorgewählter vmail Kasten

+ ErneuernSie


+ Zurück zu Hauptfenster

+
+
+ + +
GEPARKTE ANRUFE:
+ Zurück zu Hauptfenster

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEU:     ALT:             MANUELLER VORWAHLKNOPF       VORWAHLKNOPF
GEPARKTE ANRUFE: 0                LOKALE VORWAHLKNOPF-VERLÄNGERUNGEN
OUTBOUND ANRUFE:
INBOUND ANRUFE:
astGUIclient Netz-Klient VERSION: BAU:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
LIEBLINGE       redigieren sie
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
LIEBLINGE

 
SUBMITSie LIEBLINGE CHANGES - requires logout
ZURÜCK ZU MAIN FENSTER - ignorieren Sie die vorgenommenen Änderungen
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | ANFANG     Erneuern Sie Rate: 1000 ms Schneller | Langsamer

+
Initialisierung..
+
Aktive Verlängerungen
+ERNEUERNSie | +AUFTRAG | +
Äußere Linien
+ERNEUERNSie | +AUFTRAG | +
Lokale Verlängerungen
+ERNEUERNSie | +AUFTRAG | +
+ Daten Gehen Hier

+
+ Daten Gehen Hier

Stamm-Tätigkeit +
+ Daten Gehen Hier

Lokale Tätigkeit +
+
+ + + + +
+ + +Konferenz-Liste + + + +
+Klicken Sie an Konferenzzimmernummer auf dem links für Info auf +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_de/call_log_display.php b/LANG_agc/LANG_agc/agc_de/call_log_display.php new file mode 100644 index 0000000..c8103ac --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Anruf-Maschinenbordbuch-Anzeige"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/conf_exten_check.php b/LANG_agc/LANG_agc/agc_de/conf_exten_check.php new file mode 100644 index 0000000..d41cda6 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Verlängerung Überprüfung"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten ist unzulässig\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $FührungA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $FührungA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$FührungA[$counter] ~"; + # echo "$FührungA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten ist unzulässig or Exten $exten ist unzulässig\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Konferenz $conf_exten ist zu registriert worden $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/dbconnect.php b/LANG_agc/LANG_agc/agc_de/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_de/inbound_popup.php b/LANG_agc/LANG_agc/agc_de/inbound_popup.php new file mode 100644 index 0000000..b6353ba --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +INBOUND LEBHAFTANRUF"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

INBOUND LEBHAFTANRUF

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid ist unzulässig\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Führung: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Führung=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "GEWOHNHEIT - \n"; + + echo "
Nummer Gewählt: $row[8]
Anmerkungen: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HÄNGEZUSTAND - \n"; + echo "SENDEN SIE ZU MEINEM VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/live_exten_check.php b/LANG_agc/LANG_agc/agc_de/live_exten_check.php new file mode 100644 index 0000000..9ec1b42 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Phasenverlängerung Überprüfung"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $FührungA[$loop_count] = "$row[0]"; + $FührungB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$FührungA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "FührungA: $FührungA[$counter] ~"; + echo "FührungB: $FührungB[$counter] ~"; + echo "FührungBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$FührungA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "FührungA: $FührungA[$counter] ~"; + echo "FührungB: $FührungB[$counter] ~"; + echo "FührungBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$FührungB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "FührungA: $FührungA[$counter] ~"; + echo "FührungB: $FührungB[$counter] ~"; + echo "FührungBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$FührungB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "FührungA: $FührungA[$counter] ~"; + echo "FührungB: $FührungB[$counter] ~"; + echo "FührungBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "FührungA: $FührungA[$counter] ~"; + echo "FührungB: $FührungB[$counter] ~"; + echo "FührungBtrunk: $FührungA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/manager_send.php b/LANG_agc/LANG_agc/agc_de/manager_send.php new file mode 100644 index 0000000..6300027 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Senden: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HILFE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht eingesetzt\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate Befehl gesendet für Exten $exten Führung $channel auf $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nOriginateName Action nicht gesendet\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nOriginateNameVmail Action nicht gesendet\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht eingesetzt\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate Befehl gesendet für Exten $exten Führung $channel auf $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten ist unzulässig or ext_context $ext_context or queryCID $queryCID ist unzulässig, Hangup Befehl nicht eingesetzt\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Führung $channel ist unzulässig or queryCID $queryCID ist unzulässig, Hangup Befehl nicht eingesetzt\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel ist nicht Phasen auf $call_server_ip, Checking Live Führung...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Führung $channel ist nicht Phasen auf $call_server_ip, Hangup Befehl nicht eingesetzt $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup Befehl gesendet für Führung $channel auf $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "auto_dial_level $auto_dial_level muß eingestellt werden\n"; + echo "campaign $campaign muß eingestellt werden\n"; + echo "uniqueid $uniqueid muß eingestellt werden\n"; + echo "lead_id $lead_id muß eingestellt werden\n"; + echo "\nRedirectVD Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "parkedby $parkedby muß eingestellt werden\n"; + echo "\nRedirectToPark Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectFromPark Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectName Action nicht gesendet\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectNameVmail Action nicht gesendet\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "ExtraFührung $extrachannel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirect Action nicht gesendet\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Kann nicht leere Konferenz finden auf $server_ip, Redirect Befehl nicht eingesetzt\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Führung $channel ist nicht Phasen auf $call_server_ip, Redirect Befehl nicht eingesetzt\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Führung $channel ist nicht Phasen auf $server_ip, Redirect Befehl nicht eingesetzt\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra Befehl gesendet für Führung $channel and \nExtraFührung $extrachannel\n to $exten auf $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra Befehl gesendet für Führung $channel auf $call_server_ip and \nExtraFührung $extrachannel\n to $exten auf $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Führung $channel muß als 2 Buchstaben grösser sein\n"; + echo "queryCID $queryCID muß als 14 Buchstaben grösser sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirect Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Führung $channel ist nicht Phasen auf $server_ip, Redirect Befehl nicht eingesetzt\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect Befehl gesendet für Führung $channel auf $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Führung $channel ist unzulässig or queryCID $queryCID ist unzulässig or filename: $filename ist unzulässig, $ACTION Befehl nicht eingesetzt\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Führung $channel ist nicht Phasen auf $server_ip, $ACTION Befehl nicht eingesetzt\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION Befehl gesendet für Führung $channel auf $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Führung $channel ist unzulässig or exten $exten ist unzulässig or filename: $filename ist unzulässig, $ACTION Befehl nicht eingesetzt\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going auf in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION Befehl gesendet für Führung $channel auf $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n AUFNAHME DAUERT BIS 60 MINUTEN\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_de/park_calls_display.php b/LANG_agc/LANG_agc/agc_de/park_calls_display.php new file mode 100644 index 0000000..67f868c --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Geparkte Anruf-Anzeige"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/vdc_db_query.php b/LANG_agc/LANG_agc/agc_de/vdc_db_query.php new file mode 100644 index 0000000..5f0052e --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Datenbank-Frage Index"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Gruppe Wahl $closer_choice ist unzulässig\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Gruppe Wahl $closer_choice ist zu registriert worden user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "ZUFUHRBEHÄLTER LEER\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INANRUF + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "ZUFUHRBEHÄLTER LEER\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INANRUF + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "ANRUF NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID ist unzulässig\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "MASCHINENBORDBUCH NICHT BETRETEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign ist unzulässig\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Eingesetzt: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "MASCHINENBORDBUCH NICHT BETRETEN\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "ANRUF_LOG Eingesetzt: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "MASCHINENBORDBUCH NICHT BETRETEN\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "MASCHINENBORDBUCH NICHT BETRETEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id ist unzulässig\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "MASCHINENBORDBUCH NICHT BETRETEN\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampagne $campaign ist unzulässig\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INANRUF in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INANRUF + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INANRUF + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INANRUF + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send auf to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user auf $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten ist unzulässig\n"; + exit; + } +else + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation auf the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id ist unzulässig\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### ANRUFBACK ENTRY + if ( ($dispo_choice == 'CBHALT') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' ist zu geändert worden ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id ist unzulässig\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id Informationen sind aktualisiert worden\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage ist unzulässig\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' ist jetzt im Status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list ist unzulässig\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_de/vicidial.php b/LANG_agc/LANG_agc/agc_de/vicidial.php new file mode 100644 index 0000000..dd90edf --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Sie haben jetzt heraus geloggt. Danke\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "VICIVORWAHLKNOPF web client: Re-LOGON\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-LOGON
 
Telefon-LOGON:
Telefon-Kennwort:
Benutzer-LOGON:
Benutzer-Kennwort:
Kampagne: $camp_form_code

VERSION: $version       BAU: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIVORWAHLKNOPF web client: Kampagne LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Benutzer-LOGON

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kampagne LOGON
 
Benutzer-LOGON:
Benutzer-Kennwort:
Kampagne: $camp_form_code

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIVORWAHLKNOPF web client: LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
LOGON
 
Telefon-LOGON:
Telefon-Kennwort:
Benutzer-LOGON:
Benutzer-Kennwort:
Kampagne: $camp_form_code

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIVORWAHLKNOPF web client: Telefon-LOGON\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Telefon-LOGON
 
Telefon-LOGON:
Telefon-Kennwort:

VERSION: $version       BAU: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Die aktive Kampagne nicht, versuchen bitte noch einmal
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Der falsche LOGON, versuchen bitte noch einmal
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIVORWAHLKNOPF web client: Kampagne LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kampagne LOGON
 
Benutzer-LOGON:
Benutzer-Kennwort:
Kampagne: $camp_form_code

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIVORWAHLKNOPF web client: Telefon-LOGON Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
LOGON Error
 
Traurig, Ihr Telefon-LOGON und Kennwort seien Sie nicht in diesem:
 
Telefon-LOGON:
Telefon-Kennwort:

VERSION: $version       BAU: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIVORWAHLKNOPF web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed auf this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login auf phone: $SIP_user zur Kampagne: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NEU record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "VICIVORWAHLKNOPF web client: VICIVORWAHLKNOPF Kampagne LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Traurig, gibt es keine Leitungen im Zufuhrbehälter für diese\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "LOGON: \n
"; + echo "Kennwort:
\n"; + echo "Kampagne: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIVORWAHLKNOPF web client: VICIVORWAHLKNOPF Kampagne LOGON\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "LOGON: \n
"; + echo "Kennwort:
\n"; + echo "Kampagne: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICIVORWAHLKNOPFSCRIPT   LIVE     Lernabschnitt ID: Leben Anruf
+
+ + + + +

VICIVORWAHLKNOPF
+
+ + + + +
+ + Übertragung - Konferenz
+ INTERNES GENAUERES + EINHEIMISCHER GENAUER + CODE + Hängezustand Xfer Linie + Hängezustand Beide Linien + +
+ + Zahl zum zu benennen   + Sekunden   + channel + + OVERRIDE   + D1 + D2 +
+ + Vorwahlknopf Mit Kunden + Park-Kunde Vorwahlknopf + ANRUF DES URLAUB-3-WAY + Vorwahlknopf-Vorhang-Übertragung + Blind Transfer VMail Message +
+
+
+ + + + +
Leitung Dispositioned Wie:

+ -
+
+
+ + + + + + + +
Einteilung Heiße Schlüssel: + Wenn aktiv, betätigen Sie einfach die Taste für die gewünschte:
+ + + + + +
+
+ + +
Noone ist in Ihrem Lernabschnitt:
+ OK +
+
+ + +
Kunde hat oben gehangen:
+ OK +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Alle mögliche Änderungen, die am Kunden vorgenommen wurden, den, Informationen unten diesmal nicht sind, comitted, Sie müssen Kunde Informationen vor Ihnen ändern Hängezustand der Anruf.
+
+ + +
EINTEILUNG ANRUF :       setzen Sie herab
+ Ende-von-benennen Sie Einteilung Vorwähler +
+ STOPPEN SIE ZU BENENNEN
+ ZURÜCKSTELLEN | + SUBMITSie +



  +
+
+ + + +
Wählen Sie ein Wiederholungsbesuch Datum vor :
+ + + Wählen Sie ein Datum unten vor   +     + Hour: +   + Minutes: +   + +  
+ + COLUMBIUM Anmerkungen:

+ + SUBMITSie

+ + +

  +
+
+ + +
GENAUERE INBOUND GRUPPENWAHL
+ Genauere Inbound Gruppenwahl +
+ GEMISCHTES BENENNEN(outbound aktiviert)
+ ZURÜCKSTELLEN | + SUBMITSie +



  +
+
+ + + + + + + + + + + +
PHASENANRUF-ÜBERTRAGUNG
Gebracht zu werden Führung: Führung
Verlängerungen:
Verlängerungen Menü
+
+ Senden Sie zu vorgewählter Verlängerung

+ Senden Sie zu vorgewähltem vmail Kasten

+ Senden Sie zu dieser Zahl:


+ ERNEUERNSie


+ Zurück zu Hauptfenster

+
Konferenzen:
(klicken Sie an eine Zahl unten, um zu einer Konferenz zu senden)
Senden Sie meine Führung auch
Konferenz-Menü
+
+ + + + +
VICIVORWAHLKNOPF SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUS:
+
+Vorwahlknopf-Folgende Zahl
+ LEITUNG VORBETRACHTUNG
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " WECH TELEFON
";} + + +?> +REGISTERAKTE:
+
+
+SATZ IDENTIFIKATION:
+
+ +Fangen Sie an Zu notieren
+
+Netz-Form
+
+Park-Anruf
+Übertragung - Konferenz
+
+Hängezustand-Kunde
+
+Senden Sie DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
Sekunden:   Führung:   Cust Zeit:
Kunde Informationen:
Titel:   Zuerst:   MI:  Letztes:
Adresse1:
Adresse2:   Adresse3:
Stadt:   Zustand:   PostCode:
Provinz:   Verkäufer Identifikation:
Telefon:   DialCode:   Wech Telefon:
Erscheinen:   Email:
Anmerkungen:
+ +
+


  + +
+ + + + +
VICIVORWAHLKNOPF Netz-Klient Version:     BAU:               Bediener:              
+Zeigen Sie Konferenzanruf-Führung Informationen
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HEISSE SCHLÜSSEL UNAKTIVIERT + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_de/voicemail_check.php b/LANG_agc/LANG_agc/agc_de/voicemail_check.php new file mode 100644 index 0000000..acb1d46 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_de/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Unzulässig Benutzername/Kennwort: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Unzulässig session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Überprüfung"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail Kasten $vmail_box ist unzulässig\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/active_list_refresh.php b/LANG_agc/LANG_agc/agc_el/active_list_refresh.php new file mode 100644 index 0000000..2361537 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Κατάλογος Οθόνης: "; +if ($ADD==1) {echo "ΕνεÏγές τηλ. συνδέσεις";} +if ($ADD==2) {echo "Απασχολημένες τηλ. συνδέσεις";} +if ($ADD==3) {echo "ΕξωτεÏικές γÏαμμές";} +if ($ADD==4) {echo "Τοπικές τηλ. συνδέσεις";} +if ($ADD==5) {echo "Διασκέψεις";} +if ($ADD==99999) {echo "ΒΟΗΘΕΙΑ";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_el/astguiclient.php b/LANG_agc/LANG_agc/agc_el/astguiclient.php new file mode 100644 index 0000000..4d79706 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: ΣÏνδεση\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIΚΛΗΣΗ|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIΚΛΗΣΗ|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: ΣÏνδεση Τηλεφώνου\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΣÏνδεση Τηλεφώνου
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: ΣÏνδεση Τηλεφώνου\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση Τηλεφώνου
 
Συγγνώμη, αλλά η τηλεφωνική σÏνδεση και ο κωδικός Ï€Ïόσβασής σας δεν είναι ενεÏγά σε αυτό το σÏστημα, παÏακαλώ Ï€Ïοσπαθήστε πάλι:
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +ΑΠΟΣΥÎΔΕΣΗ
\n"; ?> +
ΚÏÏιος ΠίνακαςΠίνακας ΕνεÏγών ΓÏαμμώνΠίνακας διασκέψεωνΕλεγχος Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´ÏομείουΕνεÏγή κλήση
+
+ + +

Logout
+
+ + +
TRUNK ΚΛΕΙΣΙΜΟ

+ Active Trunks Menu
+ Κλείσιμο Trunk   |   + Κλέψιμο Trunk   |   + ΑκοÏστε Trunk   |   + Ανανέωση   |   + ΕπιστÏοφή στο κÏÏιο παÏάθυÏο +
+
+ + +
ΤΟΠΙΚΟ ΚΛΕΙΣΙΜΟ ΤΗΛΕΦΩÎΟΥ

+ ΕνεÏγές Τοπικές Επιλογές
+ Κλείσιμο Ï„Î¿Ï€Î¹ÎºÎ¿Ï   |   + Κλέψιμο Ï„Î¿Ï€Î¹ÎºÎ¿Ï   |   + ΑκοÏστε τοπικό   |   + Ανανέωση   |   + ΕπιστÏοφή στο κÏÏιο παÏάθυÏο +
+
+ + + + + + + +
ΜΕΤΑΦΟΡΑ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ
Κανάλι που μεταφέÏεται: Κανάλι
Τηλ.συνδέσεις:
Επιλογές τηλ. συνδέσεων
+
+ Στείλε στην επιλεγμένη τηλ.σÏνδεση

+ Στείλε στο επιλεγμένο vmail

+ Στείλε σε αυτόν τον αÏιθμό:


+ Ανανέωση


+ ΕπιστÏοφή στο κÏÏιο παÏάθυÏο

+
Διασκέψεις:
(επιλέξτε έναν αÏιθμό κατωτέÏω που θα σταλεί σε μια διάσκεψη)
Στείλε το κανάλι μου επίσης
Επιλογές διασκέψεων
+
+ + + + + +
ΤΟΠΙΚΕΣ τηλ. συνδέσεις Κλήσεως
Τηλέφωνο που καλεί από: Κανάλι
Τηλ.συνδέσεις:
Επιλογές τηλ. συνδέσεων
+
+ Επιλεγμένη κλήση τηλ. σÏνδεσης

+ Επιλεγμένη κλήση vmail

+ Ανανέωση


+ ΕπιστÏοφή στο κÏÏιο παÏάθυÏο

+
+
+ + +
ΣΤΑΘΜΕΥΜΕÎΕΣ ΚΛΗΣΕΙΣ:
+ ΕπιστÏοφή στο κÏÏιο παÏάθυÏο

+
+
+ + + + + + + + + + + + + + + +
  +
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ     ÎΕΟ:     ΠΑΛΑΙΟ:             ΧΕΙΡΩÎΑΚΤΙΚΗ ΚΛΗΣΗ       ΚΛΗΣΗ
ΣΤΑΘΜΕΥΜΕÎΕΣ ΚΛΗΣΕΙΣ: 0                Î¤Î—Λ. ΣΥÎΔΕΣΕΙΣ ΤΟΠΙΚΗΣ ΚΛΗΣΗΣ
ΕΞΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ:
ΕΙΣΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ:
ΈΚΔΟΣΗ astGUIclient: ΔΗΜΙΟΥΡΓΙΑ:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
ΣΥΜΠΑΘΕΙΕΣ       εκδώστε
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
ΣΥΜΠΑΘΕΙΕΣ

 
ΥΠΟΒΑΛΕΤΕ ΣΥΜΠΑΘΕΙΕΣ CHANGES - requires logout
ΠΙΣΩ στο ΚΥΡΙΟ ΠΑΡΑΘΥΡΟ - αγνοήστε τις αλλαγές που γίνονται
+
+ +
+ + + + + + + + + + + + + +
+ΠΑΥΣΗ | ΕÎΑΡΞΗ     Ποσοστό ανανέωσης: 1000 ms ΓÏηγοÏότεÏα | Πιό αÏγά

+
ΑÏχή..
+
ΕνεÏγές τηλ. συνδέσεις
+ΑÎΑÎΕΩΣΗ | +ΔΙΑΤΑΓΗ | +
ΕξωτεÏικές γÏαμμές
+ΑÎΑÎΕΩΣΗ | +ΔΙΑΤΑΓΗ | +
Τοπικές τηλ. συνδέσεις
+ΑÎΑÎΕΩΣΗ | +ΔΙΑΤΑΓΗ | +
+ Τα δεδομένα πηγαίνουν εδώ

+
+ Τα δεδομένα πηγαίνουν εδώ

Κίνηση Trunk +
+ Τα δεδομένα πηγαίνουν εδώ

Τοπική Κίνηση +
+
+ + + + +
+ + +Κατάλογος διασκέψεων + + + +
+Επιλέξτε έναν αÏιθμό δωματίου διάσκεψης στα αÏιτεÏά για τις πληÏοφοÏίες σε εκείνη την διάσκεψη +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_el/call_log_display.php b/LANG_agc/LANG_agc/agc_el/call_log_display.php new file mode 100644 index 0000000..9559ad8 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Έμφάνιση ΚαταγÏαμμένων Κλήσεων"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten δεν ισχÏει ή Ï€Ïωτόκολλο $protocol δεν ισχÏει\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/conf_exten_check.php b/LANG_agc/LANG_agc/agc_el/conf_exten_check.php new file mode 100644 index 0000000..e6eb956 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Έλεγχος τηλ.σÏνδεσης διάσκεψης"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten δεν ισχÏει\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ΚανάλιA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ΚανάλιA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ΚανάλιA[$counter] ~"; + # echo "$ΚανάλιA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten δεν ισχÏει or Exten $exten δεν ισχÏει\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Διάσκεψη $conf_exten έχει καταχωÏηθεί $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/dbconnect.php b/LANG_agc/LANG_agc/agc_el/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_el/inbound_popup.php b/LANG_agc/LANG_agc/agc_el/inbound_popup.php new file mode 100644 index 0000000..e017b13 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +ΕÎΕΡΓΗ ΕΙΣΕΡΧΟΜΕÎΗ ΚΛΗΣΗ"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

ΕÎΕΡΓΗ ΕΙΣΕΡΧΟΜΕÎΗ ΚΛΗΣΗ

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid δεν ισχÏει\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Κανάλι: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Κανάλι=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "ΣΥÎΗΘΕΙΑ - \n"; + + echo "
ΑÏιθμός που καλέσατε: $row[8]
Σημειώσεις: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "ΚΛΕΙΣΙΜΟ - \n"; + echo "ΣΤΕΙΛΕ ΣΤΟ ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ ΜΟΥ\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/live_exten_check.php b/LANG_agc/LANG_agc/agc_el/live_exten_check.php new file mode 100644 index 0000000..083caa1 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Ελεγχος ενεÏγής τηλ.σÏνδεσης"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten δεν ισχÏει ή Ï€Ïωτόκολλο $protocol δεν ισχÏει\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ΚανάλιA[$loop_count] = "$row[0]"; + $ΚανάλιB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ΚανάλιA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ΚανάλιA: $ΚανάλιA[$counter] ~"; + echo "ΚανάλιB: $ΚανάλιB[$counter] ~"; + echo "ΚανάλιBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ΚανάλιA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ΚανάλιA: $ΚανάλιA[$counter] ~"; + echo "ΚανάλιB: $ΚανάλιB[$counter] ~"; + echo "ΚανάλιBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ΚανάλιB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ΚανάλιA: $ΚανάλιA[$counter] ~"; + echo "ΚανάλιB: $ΚανάλιB[$counter] ~"; + echo "ΚανάλιBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ΚανάλιB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ΚανάλιA: $ΚανάλιA[$counter] ~"; + echo "ΚανάλιB: $ΚανάλιB[$counter] ~"; + echo "ΚανάλιBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ΚανάλιA: $ΚανάλιA[$counter] ~"; + echo "ΚανάλιB: $ΚανάλιB[$counter] ~"; + echo "ΚανάλιBtrunk: $ΚανάλιA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/manager_send.php b/LANG_agc/LANG_agc/agc_el/manager_send.php new file mode 100644 index 0000000..0c2be0a --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Ο διευθυντής στέλνει: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "ΒΟΗΘΕΙΑ";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Originate εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate εντολή που στέλνεται για Exten $exten Κανάλι $channel Στην $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nOriginateName Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nOriginateNameVmail Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Originate εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate εντολή που στέλνεται για Exten $exten Κανάλι $channel Στην $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten δεν ισχÏει or ext_context $ext_context or queryCID $queryCID δεν ισχÏει, Hangup εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Hangup εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel δεν είναι ενεÏγό Στην $call_server_ip, Checking Live Κανάλι...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό Στην $call_server_ip, Hangup εντολή που δεν έγινε εισαγωγή $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup εντολή που στέλνεται για Κανάλι $channel Στην $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "auto_dial_level $auto_dial_level Ï€Ïέπει να τεθεί\n"; + echo "campaign $campaign Ï€Ïέπει να τεθεί\n"; + echo "uniqueid $uniqueid Ï€Ïέπει να τεθεί\n"; + echo "lead_id $lead_id Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectVD Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "parkedby $parkedby Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectToPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectFromPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectName Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectNameVmail Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "ExtraΚανάλι $extrachannel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirect Action μην σταλμένος\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Δεν υπάÏχει κενή διάσκεψη Στην $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Κανάλι $channel δεν είναι ενεÏγό Στην $call_server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Κανάλι $channel δεν είναι ενεÏγό Στην $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra εντολή που στέλνεται για Κανάλι $channel and \nExtraΚανάλι $extrachannel\n to $exten Στην $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra εντολή που στέλνεται για Κανάλι $channel Στην $call_server_ip and \nExtraΚανάλι $extrachannel\n to $exten Στην $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirect Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό Στην $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect εντολή που στέλνεται για Κανάλι $channel Στην $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or queryCID $queryCID δεν ισχÏει or filename: $filename δεν ισχÏει, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό Στην $server_ip, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION εντολή που στέλνεται για Κανάλι $channel Στην $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or exten $exten δεν ισχÏει or filename: $filename δεν ισχÏει, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going Στην in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION εντολή που στέλνεται για Κανάλι $channel Στην $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n Η ΚΑΤΑΓΡΑΦΗ ΘΑ ΔΙΑΡΚΕΣΕΙ ΜΕΧΡΙ 60 ΛΕΠΤΑ\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_el/park_calls_display.php b/LANG_agc/LANG_agc/agc_el/park_calls_display.php new file mode 100644 index 0000000..2da41b4 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Εμφάνιση Σταθμευμένων Κλήσεων"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten δεν ισχÏει ή Ï€Ïωτόκολλο $protocol δεν ισχÏει\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/vdc_db_query.php b/LANG_agc/LANG_agc/agc_el/vdc_db_query.php new file mode 100644 index 0000000..0af92db --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Κώδικας εÏώτησης βάσεων δεδομένων"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Επιλογή ομάδας $closer_choice δεν ισχÏει\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Επιλογή ομάδας $closer_choice έχει καταχωÏηθεί user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "ΚΕÎΟΣ HOPPER\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INΚΛΗΣΗ + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "ΚΕÎΟΣ HOPPER\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INΚΛΗΣΗ + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "ΚΛΗΣΗ NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID δεν ισχÏει\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign δεν ισχÏει\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Εισαγωγή : $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "ΚΛΗΣΗ_LOG Εισαγωγή : $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id δεν ισχÏει\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "ΕκστÏατεία $campaign δεν ισχÏει\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INΚΛΗΣΗ in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INΚΛΗΣΗ + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INΚΛΗΣΗ + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INΚΛΗΣΗ + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send Στην to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user Στην $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten δεν ισχÏει\n"; + exit; + } +else + { + ##### Insert a ΑΠΟΣΥÎΔΕΣΗ record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','ΑΠΟΣΥÎΔΕΣΗ','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation Στην the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id δεν ισχÏει\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### ΚΛΗΣΗBACK ENTRY + if ( ($dispo_choice == 'CBHΠΑΛΑΙΟ') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' έχει αλλαχτεί ' . $dispo_choice . " Κατάσταση\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id δεν ισχÏει\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id οι πληÏοφοÏίες έχουν ενημεÏωθεί\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage δεν ισχÏει\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' είναι τώÏα στη κατάσταση ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list δεν ισχÏει\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_el/vicidial.php b/LANG_agc/LANG_agc/agc_el/vicidial.php new file mode 100644 index 0000000..ee49fb0 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "VICIΚΛΗΣΗ web client: ΕπανασÏνδεση\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΕπανασÏνδεση
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIΚΛΗΣΗ web client: ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

ΣÏνδεση χÏήστη

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση εκστÏατείας
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIΚΛΗΣΗ web client: ΣÏνδεση\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIΚΛΗΣΗ web client: ΣÏνδεση Τηλεφώνου\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΣÏνδεση Τηλεφώνου
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η εκστÏατεία είναι μη ενεÏγή, παÏακαλώ Ï€Ïοσπαθήστε πάλι
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η σÏνδεση δεν είναι σωστή, παÏακαλώ Ï€Ïοσπαθήστε πάλι
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIΚΛΗΣΗ web client: ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση εκστÏατείας
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIΚΛΗΣΗ web client: ΣÏνδεση Τηλεφώνου Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση Error
 
Συγγνώμη, αλλά η τηλεφωνική σÏνδεση και ο κωδικός Ï€Ïόσβασής σας δεν είναι ενεÏγά σε αυτό το σÏστημα, παÏακαλώ Ï€Ïοσπαθήστε πάλι:
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIΚΛΗΣΗ web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed Στην this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login Στην phone: $SIP_user στην εκστÏατεία: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a ÎΕΟ record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "VICIΚΛΗΣΗ web client: VICIΚΛΗΣΗ ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Συγγνώμη, δεν υπάÏχουν καθοδηγητές στον hopper για αυτήν την εκστÏατεία\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ΣÏνδεση: \n
"; + echo "Κωδικός Ï€Ïόσβασης:
\n"; + echo "ΕκστÏατεία: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIΚΛΗΣΗ web client: VICIΚΛΗΣΗ ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ΣÏνδεση: \n
"; + echo "Κωδικός Ï€Ïόσβασης:
\n"; + echo "ΕκστÏατεία: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +ΑΠΟΣΥÎΔΕΣΗ\n"; ?> +
+
+ + + + + + + + +
VICIΚΛΗΣΗSCRIPT   LIVE     Ταυτότητα εÏγασίας: ΕνεÏγή κλήση
+
+ + + + +

VICIΚΛΗΣΗ
+
+ + + + +
+ + ΜεταφοÏά - διάσκεψη
+ ΕΣΩΤΕΡΙΚΟΣ CLOSER + ΤΟΠΙΚΟΣ CLOSER + CODE + Κλείσιμο ΓÏαμμής Xfer + Κλείσιμο και τις δÏο γÏαμμές + +
+ + ΑÏιθμός για κλήση   + δευτεÏόλεπτα   + channel + + OVERRIDE   + D1 + D2 +
+ + Κλήση με τον πελάτη + Στάθμευση κλήσης πελάτη + ΑΠΟΧΩΡΗΣΗ 3WAY ΚΛΗΣΗΣ + Τυφλή μεταφοÏά κλήσης + Blind Transfer VMail Message +
+
+
+ + + + +
ΤεÏματισμό Καθοδήγησης όπως:

+ -
+
+
+ + + + + + + +
ΠλήκτÏα κλειδιά ΤεÏματισμοÏ: + Όταν είναι ενεÏγό, πιέστε απλά το πλήκτÏο κλειδί για τον επιθυμητό τεÏματισμό της κλήσης. Η κλήση θα Ï„Ïεματίσει αυτόματα:
+ + + + + +
+
+ + +
Κανένας δεν είναι στη σÏνοδό σας:
+ OK +
+
+ + +
Ο πελάτης έχει κλείσει το τηλέφωνο:
+ OK +
+
+ + +

ΑΠΟΣΥÎΔΕΣΗ
+
+ + +
+
+ + +
 
+
+ + +
Οποιεσδήποτε αλλαγές που γίνονται στις πληÏοφοÏίες πελατών κατωτέÏω αυτή τη στιγμή δεν θα είναι, Ï€Ïέπει να αλλάξετε τις πληÏοφοÏίες πελατών ενώπιον σας Hangup η κλήση.
+
+ + +
ΤεÏματισμός Κλήσης :       ελαχιστοποιήστε
+ Επιλογή τεÏÎ¼Î±Ï„Î¹ÏƒÎ¼Î¿Ï Ï„Î·Ï‚ κλήσης +
+ ΤΕΡΜΑΤΙΣΜΟΣ ΚΛΗΣΗΣ
+ ΕΠΑÎΑΦΟΡΑ | + ΥΠΟΒΑΛΕΤΕ +



  +
+
+ + + +
Επιλέξτε μια ημεÏομηνία CallBack :
+ + + Επιλέξτε μια ημεÏομηνία κατωτέÏω   +     + Hour: +   + Minutes: +   + +  
+ + Σχόλια CB:

+ + ΥΠΟΒΑΛΕΤΕ

+ + +

  +
+
+ + +
CLOSER ΕΙΣΕΡΧΟΜΕÎΗ ΕΠΙΛΟΓΗ ΟΜΑΔΑΣ
+ Επιλογή Closer εισεÏχόμενης ομάδας +
+ ΣΥÎΔΥΑΣΜΕÎΗ ΚΛΗΣΗ(εξεÏχόμενες ενεÏγοποιημένες)
+ ΕΠΑÎΑΦΟΡΑ | + ΥΠΟΒΑΛΕΤΕ +



  +
+
+ + + + + + + + + + + +
ΜΕΤΑΦΟΡΑ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ
Κανάλι που μεταφέÏεται: Κανάλι
Τηλ.συνδέσεις:
Επιλογές τηλ. συνδέσεων
+
+ Στείλε στην επιλεγμένη τηλ.σÏνδεση

+ Στείλε στο επιλεγμένο vmail

+ Στείλε σε αυτόν τον αÏιθμό:


+ ΑÎΑÎΕΩΣΗ


+ ΕπιστÏοφή στο κÏÏιο παÏάθυÏο

+
Διασκέψεις:
(επιλέξτε έναν αÏιθμό κατωτέÏω που θα σταλεί σε μια διάσκεψη)
Στείλε το κανάλι μου επίσης
Επιλογές διασκέψεων
+
+ + + + +
VICIΚΛΗΣΗ SCRIPT
+
+ + + + + + + + + + + + + + + + + +
ΚΑΤΑΣΤΑΣΗ:
+
+Κλήση επόμενου αÏιθμοÏ
+ ΠΡΟΒΟΛΗ ΚΑΘΟΔΗΓΗΣΗΣ
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ΚΛΗΣΗ ENAΛ/ΚΟΥ ΤΗΛΕΦΩÎΟΥ
";} + + +?> +ΑΡΧΕΙΟ ΚΑΤΑΓΡΑΦΗΣ:
+
+
+ΤΑΥΤΟΤΗΤΑ ΕΓΓΡΑΦΗΣ:
+
+ +ΕναÏξη καταγÏαφής
+
+Σελίδα ΔιαδικτÏου
+
+Στάθμευση Κλήσης
+ΜεταφοÏά - διάσκεψη
+
+΄Κλείσιμο Πελάτη
+
+Στείλε DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
δευτεÏόλεπτα:   Κανάλι:   ΧÏόνος Πελάτη:
ΠληÏοφοÏίες πελατών:
Τίτλος:   ΠÏώτο:   MI:  ΔιάÏκεια:
ΔιεÏθυνση1:
ΔιεÏθυνση2:   ΔιεÏθυνση3:
Πόλη:   ΚÏάτος:   Ταχ.Κωδ.:
ΕπαÏχία:   Ταυτότητα Ï€ÏομηθευτοÏ:
Τηλέφωνο:   Κωδικός Κλήσης:   Εναλ/κό Τηλέφωνο:
ΠαÏουσίαση:   ΗλεκτÏονικό ταχυδÏομείο:
Σχόλια:
+ +
+


  + +
+ + + + +
Έκδοση VICIΚΛΗΣΗ:     ΔΗΜΙΟΥΡΓΙΑ:               ΚεντÏικός υπολογιστής:              
+ΠαÏουσίαση πληÏοφοÏιών κλήσης ÎºÎ±Î½Î±Î»Î¹Î¿Ï Î´Î¹Î±ÏƒÎºÎ­ÏˆÎ·Ï‚
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +ΠΛΗΚΤΡΑ ΚΛΕΙΔΙΑ ΑÎΕÎΕΡΓΑ + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_el/voicemail_check.php b/LANG_agc/LANG_agc/agc_el/voicemail_check.php new file mode 100644 index 0000000..f7ec973 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_el/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "ΑκυÏο ΧÏήστηςname/Κωδικός Ï€Ïόσβασης: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "ΑκυÏο server_ip: |$server_ip| or ΑκυÏο session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "ΑκυÏο session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Έλεγχος Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "Κουτί Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου $vmail_box δεν ισχÏει\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/active_list_refresh.php b/LANG_agc/LANG_agc/agc_en/active_list_refresh.php new file mode 100644 index 0000000..301e5ed --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "List Display: "; +if ($ADD==1) {echo "Live Extensions";} +if ($ADD==2) {echo "Busy Extensions";} +if ($ADD==3) {echo "Outside Lines";} +if ($ADD==4) {echo "Local Extensions";} +if ($ADD==5) {echo "Conferences";} +if ($ADD==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_en/astguiclient.php b/LANG_agc/LANG_agc/agc_en/astguiclient.php new file mode 100644 index 0000000..3c67d01 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_en/call_log_display.php b/LANG_agc/LANG_agc/agc_en/call_log_display.php new file mode 100644 index 0000000..7918756 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/conf_exten_check.php b/LANG_agc/LANG_agc/agc_en/conf_exten_check.php new file mode 100644 index 0000000..671d29b --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/dbconnect.php b/LANG_agc/LANG_agc/agc_en/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_en/inbound_popup.php b/LANG_agc/LANG_agc/agc_en/inbound_popup.php new file mode 100644 index 0000000..ec418bc --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/live_exten_check.php b/LANG_agc/LANG_agc/agc_en/live_exten_check.php new file mode 100644 index 0000000..7fdd573 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ChannelA[$loop_count] = "$row[0]"; + $ChannelB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $ChannelA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/manager_send.php b/LANG_agc/LANG_agc/agc_en/manager_send.php new file mode 100644 index 0000000..e6887a2 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_en/park_calls_display.php b/LANG_agc/LANG_agc/agc_en/park_calls_display.php new file mode 100644 index 0000000..ce421f5 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/vdc_db_query.php b/LANG_agc/LANG_agc/agc_en/vdc_db_query.php new file mode 100644 index 0000000..7fbc2fd --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Invalid Username/Password: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_en/vicidial.php b/LANG_agc/LANG_agc/agc_en/vicidial.php new file mode 100644 index 0000000..e217b09 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICIDIALSCRIPT   LIVE     session ID: Live Call
+
+ + + + +

VICIDIAL
+
+ + + + +
+ + Transfer - Conference
+ INTERNAL CLOSER + LOCAL CLOSER + CODE + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + seconds   + channel + + OVERRIDE   + D1 + D2 +
+ + Dial With Customer + Park Customer Dial + LEAVE 3-WAY CALL + Dial Blind Transfer + Blind Transfer VMail Message +
+
+
+ + + + +
Lead Dispositioned As:

+ -
+
+
+ + + + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + +
Noone is in your session:
+ OK +
+
+ + +
Customer has hung up:
+ OK +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + +
DISPOSITION CALL :       minimize
+ End-of-call Disposition Selection +
+ STOP CALLING
+ RESET | + SUBMIT +



  +
+
+ + + +
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ + CB Comments:

+ + SUBMIT

+ + +

  +
+
+ + +
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + + + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ REFRESH


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + +
VICIDIAL SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ALT PHONE DIAL
";} + + +?> +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+Send DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments:
+ +
+


  + +
+ + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_en/voicemail_check.php b/LANG_agc/LANG_agc/agc_en/voicemail_check.php new file mode 100644 index 0000000..eb01d84 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_en/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/active_list_refresh.php b/LANG_agc/LANG_agc/agc_es/active_list_refresh.php new file mode 100644 index 0000000..be5b78f --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Mostrar Listas: "; +if ($ADD==1) {echo "Extensiones Activas";} +if ($ADD==2) {echo "Extensiones Ocupadas";} +if ($ADD==3) {echo "Líneas de salida";} +if ($ADD==4) {echo "Extensiones Locales";} +if ($ADD==5) {echo "Conferencias";} +if ($ADD==99999) {echo "AYUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_es/astguiclient.php b/LANG_agc/LANG_agc/agc_es/astguiclient.php new file mode 100644 index 0000000..790f7cf --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha registrado hacia fuera. Gracias\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Conexión\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión
 
Conexión Del Usuario:
Contraseña Del Usuario:
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Conexión Del Teléfono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Del Teléfono
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Conexión Del Teléfono\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión Del Teléfono
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +SALIR
\n"; ?> +
Pantalla PrincipalPantalla Lineas ActivasPantalla de ConferenciasComprobar buzón de vozLlamada Activa
+
+ + +

Logout
+
+ + +
TRUNK COLGAR

+ Active Trunks Menu
+ Colgar Trunk   |   + Capturar Trunk   |   + Escuchar Trunk   |   + Recarga   |   + Volver a la pantalla principal +
+
+ + +
Colgar Local

+ Menú Local Activa
+ Colgar Local   |   + Capturar Local   |   + Escuchar Local   |   + Recarga   |   + Volver a la pantalla principal +
+
+ + + + + + + +
TRANSFERIR LLAMADA ACTIVA
Canal que va a ser transferido: Canal
Extensiones:
Menú Extensiones
+
+ Envíe a la extensión seleccionada

+ Enviar al buzón de voz seleccionada

+ Envíe a este número:


+ Recarga


+ Volver a la pantalla principal

+
Conferencias:
(Pinchar en un número de abajo para enviar a una conferencia)
Enviar mi canal también
Menú de Conferencias
+
+ + + + + +
Marcar a Extensiones LOCALES
Teléfono llamando desde: Canal
Extensiones:
Menú Extensiones
+
+ Llamar extensión seleccionada

+ Llamar buzón de voz seleccionado

+ Recarga


+ Volver a la pantalla principal

+
+
+ + +
LLAMADAS APARCADAS:
+ Volver a la pantalla principal

+
+
+ + + + + + + + + + + + + + + +
  +
BUZÓN DE VOZ     NUEVO:     VIEJO:             MARCADO MANUAL       DIAL
LLAMADAS APARCADAS: 0                MARCAR EXTENSIONES LOCALES
LLAMADAS SALIENTES:
LLAMADAS ENTRANTES:
versión astGUIclient del tela-cliente: CONSTRUCCION:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITOS       corrija
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITOS

 
ENVIAR FAVORITOS CHANGES - requires logout
DE NUEVO A VENTANA PRINCIPAL - no haga caso de los cambios realizados
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | COMIENZO     Actualizar la tarifa: 1000 ms Más rápido | Más lento

+
Inizializando..
+
Extensiones Activas
+ACTUALIZAR | +ORDEN | +
Líneas de salida
+ACTUALIZAR | +ORDEN | +
Extensiones Locales
+ACTUALIZAR | +ORDEN | +
+ Los Datos Van Aquí

+
+ Los Datos Van Aquí

Acciones en Trunk +
+ Los Datos Van Aquí

Acción Local +
+
+ + + + +
+ + +Lista De las Conferencias + + + +
+Pinchar a la izquierda del número de una sala de conferencias para obtener información +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_es/call_log_display.php b/LANG_agc/LANG_agc/agc_es/call_log_display.php new file mode 100644 index 0000000..9cb9298 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Motrar el registro de llamadas"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten No es válido o protocolo $protocol No es válido\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/conf_exten_check.php b/LANG_agc/LANG_agc/agc_es/conf_exten_check.php new file mode 100644 index 0000000..00c15bd --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar la Extensión de Conf"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten No es válido\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$CanalA[$counter] ~"; + # echo "$CanalA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten No es válido or Exten $exten No es válido\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferencia $conf_exten Ha sido registrado para $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/dbconnect.php b/LANG_agc/LANG_agc/agc_es/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_es/inbound_popup.php b/LANG_agc/LANG_agc/agc_es/inbound_popup.php new file mode 100644 index 0000000..8363b57 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +LLAMADA DE ENTRADA ACTIVA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LLAMADA DE ENTRADA ACTIVA

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid No es válido\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canal: $row[1]
LlamadorID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Canal=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "A MEDIDA - \n"; + + echo "
Número Marcado: $row[8]
Notas: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "COLGAR - \n"; + echo "ENVIAR A MI BUZÓN DE VOZ\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/live_exten_check.php b/LANG_agc/LANG_agc/agc_es/live_exten_check.php new file mode 100644 index 0000000..179a4be --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar Extensión Activa"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten No es válido o protocolo $protocol No es válido\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $CanalA[$loop_count] = "$row[0]"; + $CanalB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$CanalA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanalA: $CanalA[$counter] ~"; + echo "CanalB: $CanalB[$counter] ~"; + echo "CanalBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$CanalA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanalA: $CanalA[$counter] ~"; + echo "CanalB: $CanalB[$counter] ~"; + echo "CanalBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$CanalB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanalA: $CanalA[$counter] ~"; + echo "CanalB: $CanalB[$counter] ~"; + echo "CanalBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$CanalB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanalA: $CanalA[$counter] ~"; + echo "CanalB: $CanalB[$counter] ~"; + echo "CanalBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "CanalA: $CanalA[$counter] ~"; + echo "CanalB: $CanalB[$counter] ~"; + echo "CanalBtrunk: $CanalA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/manager_send.php b/LANG_agc/LANG_agc/agc_es/manager_send.php new file mode 100644 index 0000000..55d65ef --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Enviar al Manager: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AYUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nOriginateName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nOriginateNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten No es válido or ext_context $ext_context or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel no está activo en $call_server_ip, Checking Live Canal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $call_server_ip, Hangup comando no insertado $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando enviado a Canal $channel en $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "auto_dial_level $auto_dial_level debe ser fijado\n"; + echo "campaign $campaign debe ser fijado\n"; + echo "uniqueid $uniqueid debe ser fijado\n"; + echo "lead_id $lead_id debe ser fijado\n"; + echo "\nRedirectVD Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='TRANSFERENCIA' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='TRANSFERENCIA' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "parkedby $parkedby debe ser fijado\n"; + echo "\nRedirectToPark Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectFromPark Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "ExtraCanal $extrachannel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirect Action no enviado\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "No puede encontrar conferencia vacía en $server_ip, Redirect comando no insertado\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel no está activo en $call_server_ip, Redirect comando no insertado\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel no está activo en $server_ip, Redirect comando no insertado\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado a Canal $channel and \nExtraCanal $extrachannel\n to $exten en $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado a Canal $channel en $call_server_ip and \nExtraCanal $extrachannel\n to $exten en $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirect Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $server_ip, Redirect comando no insertado\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando enviado a Canal $channel en $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or queryCID $queryCID No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $server_ip, $ACTION comando no insertado\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or exten $exten No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going en in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA GRABACIÓN DURARà HASTA 60 MINUTOS\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_es/park_calls_display.php b/LANG_agc/LANG_agc/agc_es/park_calls_display.php new file mode 100644 index 0000000..2797370 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Mostrar Llamadas Aparcadas"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten No es válido o protocolo $protocol No es válido\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/vdc_db_query.php b/LANG_agc/LANG_agc/agc_es/vdc_db_query.php new file mode 100644 index 0000000..b6d8e24 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Opción Del Grupo $closer_choice No es válido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Opción Del Grupo $closer_choice Ha sido registrado para user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "TOLVA VACÃA\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INLLAMADA + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "TOLVA VACÃA\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INLLAMADA + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LLAMADA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID No es válido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "REGISTRO NO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign No es válido\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Insertado: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "REGISTRO NO ENTRADO\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "LLAMADA_LOG Insertado: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "REGISTRO NO ENTRADO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "REGISTRO NO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id No es válido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "REGISTRO NO ENTRADO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaña $campaign No es válido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INLLAMADA in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INLLAMADA + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INLLAMADA + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INLLAMADA + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send en to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user en $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten No es válido\n"; + exit; + } +else + { + ##### Insert a SALIR record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','SALIR','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation en the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id No es válido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### LLAMADABACK ENTRY + if ( ($dispo_choice == 'CBHVIEJO') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' se ha cambiado a ' . $dispo_choice . " Estado\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id No es válido\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id La información ha sido actualizada\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage No es válido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' ahora está en estado ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list No es válido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_es/vicidial.php b/LANG_agc/LANG_agc/agc_es/vicidial.php new file mode 100644 index 0000000..55c738d --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Usted ahora ha registrado hacia fuera. Gracias\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "web client VICIDIAL: Conexión Otra Vez\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Otra Vez
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "web client VICIDIAL: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Conexión Del Usuario

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión en la Campaña
 
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "web client VICIDIAL: Conexión\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client VICIDIAL: Conexión Del Teléfono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Del Teléfono
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La campaña no está activa, intentelo otra vez, por favor
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La conexión incorrecta, intentelo otra vez, por favor
"; + } + } + if ($VDloginDISPLAY) + { + echo "web client VICIDIAL: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión en la Campaña
 
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client VICIDIAL: Conexión Del Teléfono Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión Error
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client VICIDIAL\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $LlamadorID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed en this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login en phone: $SIP_user a la campaña: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NUEVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "web client VICIDIAL: VICIDIAL Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Lo siento, no hay leads en el hopper de esta campaña\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "web client VICIDIAL: VICIDIAL Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +SALIR\n"; ?> +
+
+ + + + + + + + +
VICIDIALSCRIPT   LIVE     sesión ID: Llamada Activa
+
+ + + + +

VICIDIAL
+
+ + + + +
+ + Transferencia - Conferencia
+ CLOSER INTERNO + CLOSER LOCAL + CODE + Colgar Línea Xfer + Colgar Ambas Líneas + +
+ + Número a llamar   + segundos   + channel + + OVERRIDE   + D1 + D2 +
+ + Marcar Con El Cliente + Dial Del Cliente Del Parque + ABANDONAR LLAMADA 3-WAY + Marcar Blind Transfer + Blind Transfer VMail Message +
+
+
+ + + + +
Lead Dispositioned Como:

+ -
+
+
+ + + + + + + +
Teclas de acceso rápido a la Disposición: + Cuando esté activo, presione simplemente la tecla para la disposición deseada para esta llamada. La llamada después será colgada y dispositioned automáticamente:
+ + + + + +
+
+ + +
Nadie está en su sesión:
+ OK +
+
+ + +
El cliente ha colgado:
+ OK +
+
+ + +

SALIR
+
+ + +
+
+ + +
 
+
+ + +
Cualquier cambio realizado al cliente que no será la información abajo en este tiempo comitted, usted debe cambiar la información del cliente antes de usted retraso la llamada.
+
+ + +
DISPOSITION LLAMADA :       reduzca al mínimo
+ selección de la disposición del End-of-call +
+ PARAR LA LLAMADA
+ REINICIAR | + ENVIAR +



  +
+
+ + + +
Seleccione una fecha del servicio repetido :
+ + + Seleccione una fecha abajo   +     + Hour: +   + Minutes: +   + +  
+ + Comentarios de los CBES:

+ + ENVIAR

+ + +

  +
+
+ + +
SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER
+ SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER +
+ BLENDED LLAMADAING(Salientes activdas)
+ REINICIAR | + ENVIAR +



  +
+
+ + + + + + + + + + + +
TRANSFERIR LLAMADA ACTIVA
Canal que va a ser transferido: Canal
Extensiones:
Menú Extensiones
+
+ Envíe a la extensión seleccionada

+ Enviar al buzón de voz seleccionada

+ Envíe a este número:


+ ACTUALIZAR


+ Volver a la pantalla principal

+
Conferencias:
(Pinchar en un número de abajo para enviar a una conferencia)
Enviar mi canal también
Menú de Conferencias
+
+ + + + +
VICIDIAL SCRIPT
+
+ + + + + + + + + + + + + + + + + +
ESTADO:
+
+Marcar el Siguiente Número
+ MOSTRAR LEAD
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " TELÉFONO DEL ALT
";} + + +?> +GRABANDO ARCHIVO:
+
+
+GRABACIÓN ID:
+
+ +Comenzar La Grabación
+
+Formulario Web
+
+Aparcar llamada
+Transferencia - Conferencia
+
+Colgar al Cliente
+
+Enviar DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
segundos:   Canal:   Tiempo:
Información Del Cliente:
Título:   Primero:   IM:   Último:
Dirección1:
Dirección2:   Dirección3:
Ciudad:   Estado:   Código Postal:
Provincia:   Vendedor ID:
Teléfono:   Código Del Dial:   Teléfono Alt:
Demostración:   Email:
Comentarios:
+ +
+


  + +
+ + + + +
versión web client VICIDIAL:     CONSTRUCCION:               Servidor:              
+Mostrar la información del canal Conferencia
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TECLAS ACCESO RÃPIDO INACTIVAS + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_es/voicemail_check.php b/LANG_agc/LANG_agc/agc_es/voicemail_check.php new file mode 100644 index 0000000..41bab94 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_es/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuarioname/Contraseña: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar el buzón de voz"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "caja del buzón de voz $vmail_box No es válido\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/active_list_refresh.php b/LANG_agc/LANG_agc/agc_fr/active_list_refresh.php new file mode 100644 index 0000000..94f9599 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Affichage De Liste: "; +if ($ADD==1) {echo "Prolongements De phase";} +if ($ADD==2) {echo "Prolongements Occupés";} +if ($ADD==3) {echo "Lignes Extérieures";} +if ($ADD==4) {echo "Prolongements Locaux";} +if ($ADD==5) {echo "Conférences";} +if ($ADD==99999) {echo "AIDE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_fr/astguiclient.php b/LANG_agc/LANG_agc/agc_fr/astguiclient.php new file mode 100644 index 0000000..5b75f3e --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Vous vous êtes maintenant déconnecté. Merci\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Ouverture\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture
 
Ouverture D'Utilisateur:
Mot de passe D'Utilisateur:
Ouverture De Téléphone:
Mot de passe De Téléphone:

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICICADRAN|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICICADRAN|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Ouverture De Téléphone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ouverture De Téléphone
 
Ouverture De Téléphone:
Mot de passe De Téléphone:

VERSION: $version       CONSTRUCTION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Ouverture De Téléphone\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture De Téléphone
 
Désolé, votre ouverture de téléphone et mot de passe ne soyez pas:
 
Ouverture De Téléphone:
Mot de passe De Téléphone:

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +DÉCONNEXION
\n"; ?> +
Panneau PrincipalLignes Actives PanneauPanneau De ConférencesVérifiez VoicemailVivent L'Appel
+
+ + +

Logout
+
+ + +
TRUNK DÉCROCHEMENT

+ Active Trunks Menu
+ Tronc De Décrochement   |   + Tronc De Détournement   |   + Écoutent Le Tronc   |   + Régénérez   |   + De nouveau à la fenêtre principale +
+
+ + +
DÉCROCHEMENT LOCAL

+ Menu Local Actif
+ Gens du pays De Décrochement   |   + Gens du pays De Détournement   |   + Écoutent Les Gens du pays   |   + Régénérez   |   + De nouveau à la fenêtre principale +
+
+ + + + + + + +
TRANSFERT DE PHASE D'APPEL
La Manche à transférer: LaManche
Prolongements:
Menu De Prolongements
+
+ Envoyez à la prolongation choisie

+ Envoyez dans la boîte choisie de vmail

+ Envoyez à ce nombre:


+ Régénérez


+ De nouveau à la fenêtre principale

+
Conférences:
(cliquez sur un nombre ci-dessous pour envoyer à une)
Envoyez mon canal aussi
Menu De Conférences
+
+ + + + + +
Cadran LOCAL De Prolongements
Téléphone appelant de: LaManche
Prolongements:
Menu De Prolongements
+
+ Prolongation choisie par appel

+ Boîte de vmail choisie par appel

+ Régénérez


+ De nouveau à la fenêtre principale

+
+
+ + +
APPELS GARÉS:
+ De nouveau à la fenêtre principale

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NOUVEAU:     VIEUX:             CADRAN MANUEL       CADRAN
APPELS GARÉS: 0                PROLONGEMENTS LOCAUX DE CADRAN
APPELS EN PARTANCE:
APPELS D'ARRIVÉE:
VERSION astGUIclient d'enchaînement-client: CONSTRUCTION:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORIS       éditez
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORIS

 
SOUMETTEZ FAVORIS CHANGES - requires logout
DE NOUVEAU À LA FENÊTRE PRINCIPALE - ignorez les changements faits
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | DÉBUT     La vitesse de régénération: 1000 ms Plus rapidement | Plus lent

+
Initialisation..
+
Prolongements Actifs
+RÉGÉNÉREZ | +ORDRE | +
Lignes Extérieures
+RÉGÉNÉREZ | +ORDRE | +
Prolongements Locaux
+RÉGÉNÉREZ | +ORDRE | +
+ Les Données Vont Ici

+
+ Les Données Vont Ici

Action De Tronc +
+ Les Données Vont Ici

Action Locale +
+
+ + + + +
+ + +Liste De Conférences + + + +
+Cliquez sur un nombre de salle de conférence du côté gauche +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_fr/call_log_display.php b/LANG_agc/LANG_agc/agc_fr/call_log_display.php new file mode 100644 index 0000000..783b255 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Affichage De Notation D'Appel"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/conf_exten_check.php b/LANG_agc/LANG_agc/agc_fr/conf_exten_check.php new file mode 100644 index 0000000..a25fd51 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Contrôle De Prolongation De Conf"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten est inadmissible\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $LaMancheA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $LaMancheA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$LaMancheA[$counter] ~"; + # echo "$LaMancheA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten est inadmissible or Exten $exten est inadmissible\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conférence $conf_exten a été enregistré à $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/dbconnect.php b/LANG_agc/LANG_agc/agc_fr/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_fr/htglobalize.php b/LANG_agc/LANG_agc/agc_fr/htglobalize.php new file mode 100644 index 0000000..72a10e1 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/htglobalize.php @@ -0,0 +1,23 @@ + $value){ + ${$key} = $value; + global ${$key};// = $value; + } + +} +array_conv($_GET); +array_conv($_POST); +array_conv($_SERVER); + +?> \ No newline at end of file diff --git a/LANG_agc/LANG_agc/agc_fr/inbound_popup.php b/LANG_agc/LANG_agc/agc_fr/inbound_popup.php new file mode 100644 index 0000000..45f0a9e --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +APPEL D'ARRIVÉE DE PHASE"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

APPEL D'ARRIVÉE DE PHASE

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid est inadmissible\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
LaManche: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_LaManche=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "COUTUME - \n"; + + echo "
Numéro Composé: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "DÉCROCHEMENT - \n"; + echo "ENVOYEZ À MON VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/live_exten_check.php b/LANG_agc/LANG_agc/agc_fr/live_exten_check.php new file mode 100644 index 0000000..cdc4187 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Contrôle De phase De Prolongation"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $LaMancheA[$loop_count] = "$row[0]"; + $LaMancheB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$LaMancheA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "LaMancheA: $LaMancheA[$counter] ~"; + echo "LaMancheB: $LaMancheB[$counter] ~"; + echo "LaMancheBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$LaMancheA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "LaMancheA: $LaMancheA[$counter] ~"; + echo "LaMancheB: $LaMancheB[$counter] ~"; + echo "LaMancheBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$LaMancheB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "LaMancheA: $LaMancheA[$counter] ~"; + echo "LaMancheB: $LaMancheB[$counter] ~"; + echo "LaMancheBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$LaMancheB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "LaMancheA: $LaMancheA[$counter] ~"; + echo "LaMancheB: $LaMancheB[$counter] ~"; + echo "LaMancheBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "LaMancheA: $LaMancheA[$counter] ~"; + echo "LaMancheB: $LaMancheB[$counter] ~"; + echo "LaMancheBtrunk: $LaMancheA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/manager_send.php b/LANG_agc/LANG_agc/agc_fr/manager_send.php new file mode 100644 index 0000000..b7c5887 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Le Directeur Envoient: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AIDE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten est inadmissible or queryCID $queryCID est inadmissible, Originate commande non insérée\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate commande envoyée pour Exten $exten LaManche $channel sur $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "extenName $extenName doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nOriginateName Action non envoyé\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "extenName $extenName doit être placé\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nOriginateNameVmail Action non envoyé\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten est inadmissible or queryCID $queryCID est inadmissible, Originate commande non insérée\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate commande envoyée pour Exten $exten LaManche $channel sur $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten est inadmissible or ext_context $ext_context or queryCID $queryCID est inadmissible, Hangup commande non insérée\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "LaManche $channel est inadmissible or queryCID $queryCID est inadmissible, Hangup commande non insérée\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel n'est pas de phase sur $call_server_ip, Checking Live LaManche...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "LaManche $channel n'est pas de phase sur $call_server_ip, Hangup commande non insérée $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup commande envoyée pour LaManche $channel sur $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "auto_dial_level $auto_dial_level doit être placé\n"; + echo "campaign $campaign doit être placé\n"; + echo "uniqueid $uniqueid doit être placé\n"; + echo "lead_id $lead_id doit être placé\n"; + echo "\nRedirectVD Action non envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "exten $exten doit être placé\n"; + echo "extenName $extenName doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "parkedby $parkedby doit être placé\n"; + echo "\nRedirectToPark Action non envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nRedirectFromPark Action non envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "extenName $extenName doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nRedirectName Action non envoyé\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "extenName $extenName doit être placé\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nRedirectNameVmail Action non envoyé\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "ExtraLaManche $extrachannel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nRedirect Action non envoyé\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Ne peut pas trouver la conférence vide sur $server_ip, Redirect commande non insérée\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "LaManche $channel n'est pas de phase sur $call_server_ip, Redirect commande non insérée\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "LaManche $channel n'est pas de phase sur $server_ip, Redirect commande non insérée\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra commande envoyée pour LaManche $channel and \nExtraLaManche $extrachannel\n to $exten sur $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra commande envoyée pour LaManche $channel sur $call_server_ip and \nExtraLaManche $extrachannel\n to $exten sur $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est inadmissible:\n"; + echo "LaManche $channel doivent être les 2 caractères plus grands que\n"; + echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n"; + echo "exten $exten doit être placé\n"; + echo "ext_context $ext_context doit être placé\n"; + echo "ext_priority $ext_priority doit être placé\n"; + echo "\nRedirect Action non envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "LaManche $channel n'est pas de phase sur $server_ip, Redirect commande non insérée\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect commande envoyée pour LaManche $channel sur $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "LaManche $channel est inadmissible or queryCID $queryCID est inadmissible or filename: $filename est inadmissible, $ACTION commande non insérée\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "LaManche $channel n'est pas de phase sur $server_ip, $ACTION commande non insérée\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION commande envoyée pour LaManche $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "LaManche $channel est inadmissible or exten $exten est inadmissible or filename: $filename est inadmissible, $ACTION commande non insérée\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going sur in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION commande envoyée pour LaManche $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n L'ENREGISTREMENT DURERA JUSQU'À 60 MINUTES\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_fr/park_calls_display.php b/LANG_agc/LANG_agc/agc_fr/park_calls_display.php new file mode 100644 index 0000000..4833f40 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Affichage Garé D'Appels"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/vdc_db_query.php b/LANG_agc/LANG_agc/agc_fr/vdc_db_query.php new file mode 100644 index 0000000..6260080 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Manuscrit De Question De Base de données"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Choix De Groupe $closer_choice est inadmissible\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Choix De Groupe $closer_choice a été enregistré à user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "DISTRIBUTEUR VIDE\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est inadmissible\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INAPPEL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "DISTRIBUTEUR VIDE\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est inadmissible\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INAPPEL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "APPEL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est inadmissible\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID est inadmissible\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "NOTATION NON ENTRÉE\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign est inadmissible\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inséré: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "NOTATION NON ENTRÉE\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "APPEL_LOG Inséré: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "NOTATION NON ENTRÉE\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "NOTATION NON ENTRÉE\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id est inadmissible\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "NOTATION NON ENTRÉE\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagne $campaign est inadmissible\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INAPPEL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INAPPEL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INAPPEL + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INAPPEL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send sur to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user sur $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten est inadmissible\n"; + exit; + } +else + { + ##### Insert a DÉCONNEXION record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','DÉCONNEXION','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation sur the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id est inadmissible\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### APPELBACK ENTRY + if ( ($dispo_choice == 'CBHVIEUX') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' a été changé en ' . $dispo_choice . " Statut\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id est inadmissible\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id l'information a été mise à jour\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage est inadmissible\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' est maintenant dans le statut ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list est inadmissible\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_fr/vicidial.php b/LANG_agc/LANG_agc/agc_fr/vicidial.php new file mode 100644 index 0000000..f2100ac --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Vous vous êtes maintenant déconnecté. Merci\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "Web client de VICICADRAN: Re-Ouverture\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Ouverture
 
Ouverture De Téléphone:
Mot de passe De Téléphone:
Ouverture D'Utilisateur:
Mot de passe D'Utilisateur:
Campagne: $camp_form_code

VERSION: $version       CONSTRUCTION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Web client de VICICADRAN: Ouverture De Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Ouverture D'Utilisateur

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture De Campagne
 
Ouverture D'Utilisateur:
Mot de passe D'Utilisateur:
Campagne: $camp_form_code

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "Web client de VICICADRAN: Ouverture\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture
 
Ouverture De Téléphone:
Mot de passe De Téléphone:
Ouverture D'Utilisateur:
Mot de passe D'Utilisateur:
Campagne: $camp_form_code

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "Web client de VICICADRAN: Ouverture De Téléphone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ouverture De Téléphone
 
Ouverture De Téléphone:
Mot de passe De Téléphone:

VERSION: $version       CONSTRUCTION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La campagne non active, essayent svp encore
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "L'ouverture incorrecte, essayent svp encore
"; + } + } + if ($VDloginDISPLAY) + { + echo "Web client de VICICADRAN: Ouverture De Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture De Campagne
 
Ouverture D'Utilisateur:
Mot de passe D'Utilisateur:
Campagne: $camp_form_code

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "Web client de VICICADRAN: Ouverture De Téléphone Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture Error
 
Désolé, votre ouverture de téléphone et mot de passe ne soyez pas:
 
Ouverture De Téléphone:
Mot de passe De Téléphone:

VERSION: $version       CONSTRUCTION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "Web client de VICICADRAN\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed sur this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login sur phone: $SIP_user à la campagne: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NOUVEAU record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "Web client de VICICADRAN: VICICADRAN Ouverture De Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Désolé, il n'y a aucun fil dans le distributeur pour cette campagne\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Web client de VICICADRAN: VICICADRAN Ouverture De Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +DÉCONNEXION\n"; ?> +
+
+ + + + + + + + +
VICICADRANSCRIPT   LIVE     ID de session: Vivent L'Appel
+
+ + + + +

VICICADRAN
+
+ + + + +
+ + Transfert - Conférence
+ PLUS ÉTROIT INTERNE + GENS DU PAYS PLUS ÉTROITS + CODE + Ligne De Xfer De Décrochement + Décrochement Les deux Lignes + +
+ + Nombre à appeler   + secondes   + channel + + OVERRIDE   + D1 + D2 +
+ + Cadran Avec Le Client + Cadran De Client De Parc + APPEL DU CONGÉ 3-WAY + Transfert D'Aveugle De Cadran + Blind Transfer VMail Message +
+
+
+ + + + +
Fil Dispositioned As:

+ -
+
+
+ + + + + + + +
Touches Directes De Disposition: + Si actif, appuyez sur simplement la touche de clavier pour la:
+ + + + + +
+
+ + +
Aucun n'est en votre session:
+ OK +
+
+ + +
Le client a raccroché:
+ OK +
+
+ + +

DÉCONNEXION
+
+ + +
+
+ + +
 
+
+ + +
Tous les changements faits au client que l'information ci-dessous actuellement ne sera pas comitted, vous doivent changer l'information de client avant vous décrochement l'appel.
+
+ + +
APPEL DE DISPOSITION :       réduisez au minimum
+ Extrémité-de-appelez Le Choix De Disposition +
+ CESSEZ D'APPELER
+ REMISE | + SOUMETTEZ +



  +
+
+ + + +
Choisissez une date de rappel de service :
+ + + Choisissez une date ci-dessous   +     + Hour: +   + Minutes: +   + +  
+ + Commentaires de CB:

+ + SOUMETTEZ

+ + +

  +
+
+ + +
UN CHOIX DE GROUPE D'ARRIVÉE PLUS ÉTROIT
+ Un Choix De Groupe D'arrivée Plus étroit +
+ APPELER MÉLANGÉ(en partance activé)
+ REMISE | + SOUMETTEZ +



  +
+
+ + + + + + + + + + + +
TRANSFERT DE PHASE D'APPEL
La Manche à transférer: LaManche
Prolongements:
Menu De Prolongements
+
+ Envoyez à la prolongation choisie

+ Envoyez dans la boîte choisie de vmail

+ Envoyez à ce nombre:


+ RÉGÉNÉREZ


+ De nouveau à la fenêtre principale

+
Conférences:
(cliquez sur un nombre ci-dessous pour envoyer à une)
Envoyez mon canal aussi
Menu De Conférences
+
+ + + + +
VICICADRAN SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUT:
+
+Prochain Nombre De Cadran
+ PRÉVISION DE FIL
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " TÉLÉPHONE D'ALT
";} + + +?> +DOSSIER D'ENREGISTREMENT:
+
+
+IDENTIFICATION DISQUE:
+
+ +Commencez À enregistrer
+
+Forme de Web
+
+Appel De Parc
+Transfert - Conférence
+
+Client De Décrochement
+
+Envoyez DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
secondes:   LaManche:   Temps De Cust:
L'Information De Client:
Titre:   D'abord:   MI :  Bout:
Adresse1:
Adresse2:   Adresse3:
Ville:   État:   Code postal:
Province:   Identification De Fournisseur:
Téléphone:   DialCode:   Alt. Téléphone:
Exposition:   Email:
Commentaires:
+ +
+


  + +
+ + + + +
Version d'enchaînement-client de VICICADRAN:     CONSTRUCTION:               Serveur:              
+Montrez l'information de canal de conférence téléphonique
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TOUCHES DIRECTES INACTIVES + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_fr/voicemail_check.php b/LANG_agc/LANG_agc/agc_fr/voicemail_check.php new file mode 100644 index 0000000..1b5c88f --- /dev/null +++ b/LANG_agc/LANG_agc/agc_fr/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inadmissible session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Contrôle De Voicemail"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "boîte de voicemail $vmail_box est inadmissible\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/active_list_refresh.php b/LANG_agc/LANG_agc/agc_it/active_list_refresh.php new file mode 100644 index 0000000..39da835 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Esposizione Della Lista: "; +if ($ADD==1) {echo "Estensioni In tensione";} +if ($ADD==2) {echo "Estensioni Occupate";} +if ($ADD==3) {echo "Linee Esterne";} +if ($ADD==4) {echo "Estensioni Locali";} +if ($ADD==5) {echo "Congressi";} +if ($ADD==99999) {echo "AIUTO";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_it/astguiclient.php b/LANG_agc/LANG_agc/agc_it/astguiclient.php new file mode 100644 index 0000000..d1db2c9 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Ora avete annotato fuori. Grazie\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Inizio attività\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività
 
Inizio attività Dell'Utente:
Parola d'accesso Dell'Utente:
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIMANOPOLA|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIMANOPOLA|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Inizio attività Del Telefono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Inizio attività Del Telefono
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Inizio attività Del Telefono\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Del Telefono
 
Spiacente, il vostri inizio attività del telefono e parola d'accesso:
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +TERMINE
\n"; ?> +
Pannello PrincipaleLinee Attive PannelloPannello Di CongressiControlli VoicemailVive La Chiamata
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Tronco Di Hangup   |   + Tronco Di Dirottamento   |   + Ascolta Il Tronco   |   + Rinfreschi   |   + Di nuovo alla finestra principale +
+
+ + +
HANGUP LOCALE

+ Menu Locale Attivo
+ Local Di Hangup   |   + Local Di Dirottamento   |   + Ascolta Il Local   |   + Rinfreschi   |   + Di nuovo alla finestra principale +
+
+ + + + + + + +
TRASFERIMENTO IN TENSIONE DI CHIAMATA
Manica da trasferire: Manica
Estensioni:
Menu Di Estensioni
+
+ Trasmetta all'estensione selezionata

+ Trasmetta alla scatola selezionata del vmail

+ _ trasmett questo numero:


+ Rinfreschi


+ Di nuovo alla finestra principale

+
Congressi:
(scatti sopra un numero qui sotto per trasmettere ad un congresso)
Trasmetta la mia scanalatura anche
Menu Di Congressi
+
+ + + + + +
Manopola LOCALE Di Estensioni
Telefono che denomina da: Manica
Estensioni:
Menu Di Estensioni
+
+ Estensione selezionata chiamata

+ Scatola del vmail selezionata chiamata

+ Rinfreschi


+ Di nuovo alla finestra principale

+
+
+ + +
CHIAMATE PARCHEGGIATE:
+ Di nuovo alla finestra principale

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NUOVO:     VECCHIO:             MANOPOLA MANUALE       MANOPOLA
CHIAMATE PARCHEGGIATE: 0                ESTENSIONI LOCALI DELLA MANOPOLA
CHIAMATE OUTBOUND:
CHIAMATE INBOUND:
VERSIONEE astGUIclient del fotoricettore-cliente: CONFIGURAZIONE:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITI       pubblichi
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITI

 
PRESENTI FAVORITI CHANGES - requires logout
DI NUOVO ALLA FINESTRA PRINCIPALE - ignori i cambiamenti fatti
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | INIZIO     La velocità di rinfrescamento: 1000 ms Più velocemente | Più lento

+
Inizializzazione..
+
Estensioni Attive
+RINFRESCHI | +ORDINE | +
Linee Esterne
+RINFRESCHI | +ORDINE | +
Estensioni Locali
+RINFRESCHI | +ORDINE | +
+ I Dati Vanno Qui

+
+ I Dati Vanno Qui

Azione Del Tronco +
+ I Dati Vanno Qui

Azione Locale +
+
+ + + + +
+ + +Lista Di Congressi + + + +
+Scatti sopra un numero di stanza di congresso a sinistra per l'Info su +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_it/call_log_display.php b/LANG_agc/LANG_agc/agc_it/call_log_display.php new file mode 100644 index 0000000..78dad07 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Esposizione Del Ceppo Di Chiamata"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten è non valido o protocollo $protocol è non valido\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/conf_exten_check.php b/LANG_agc/LANG_agc/agc_it/conf_exten_check.php new file mode 100644 index 0000000..bbfbc10 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo Di Estensione Di Conf"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten è non valido\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ManicaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ManicaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ManicaA[$counter] ~"; + # echo "$ManicaA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten è non valido or Exten $exten è non valido\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Congresso $conf_exten è stato registrato a $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/dbconnect.php b/LANG_agc/LANG_agc/agc_it/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_it/inbound_popup.php b/LANG_agc/LANG_agc/agc_it/inbound_popup.php new file mode 100644 index 0000000..b2c8549 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +CHIAMATA INBOUND IN TENSIONE"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

CHIAMATA INBOUND IN TENSIONE

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid è non valido\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Manica: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Manica=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "ABITUDINE - \n"; + + echo "
Il Numero Ha composto: $row[8]
Note: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "TRASMETTA AL MIO VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/live_exten_check.php b/LANG_agc/LANG_agc/agc_it/live_exten_check.php new file mode 100644 index 0000000..df5ed62 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo In tensione Di Estensione"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten è non valido o protocollo $protocol è non valido\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ManicaA[$loop_count] = "$row[0]"; + $ManicaB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ManicaA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ManicaA: $ManicaA[$counter] ~"; + echo "ManicaB: $ManicaB[$counter] ~"; + echo "ManicaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ManicaA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ManicaA: $ManicaA[$counter] ~"; + echo "ManicaB: $ManicaB[$counter] ~"; + echo "ManicaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ManicaB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ManicaA: $ManicaA[$counter] ~"; + echo "ManicaB: $ManicaB[$counter] ~"; + echo "ManicaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ManicaB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ManicaA: $ManicaA[$counter] ~"; + echo "ManicaB: $ManicaB[$counter] ~"; + echo "ManicaBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ManicaA: $ManicaA[$counter] ~"; + echo "ManicaB: $ManicaB[$counter] ~"; + echo "ManicaBtrunk: $ManicaA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/manager_send.php b/LANG_agc/LANG_agc/agc_it/manager_send.php new file mode 100644 index 0000000..72c7a54 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Il Responsabile Trasmette: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AIUTO";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten è non valido or queryCID $queryCID è non valido, Originate ordine non inserito\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate ordine trasmesso per Exten $exten Manica $channel su $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nOriginateName Action non trasmesso\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nOriginateNameVmail Action non trasmesso\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten è non valido or queryCID $queryCID è non valido, Originate ordine non inserito\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate ordine trasmesso per Exten $exten Manica $channel su $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten è non valido or ext_context $ext_context or queryCID $queryCID è non valido, Hangup ordine non inserito\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Manica $channel è non valido or queryCID $queryCID è non valido, Hangup ordine non inserito\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel non è in tensione su $call_server_ip, Checking Live Manica...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Manica $channel non è in tensione su $call_server_ip, Hangup ordine non inserito $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup ordine trasmesso per Manica $channel su $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "auto_dial_level $auto_dial_level deve essere regolato\n"; + echo "campaign $campaign deve essere regolato\n"; + echo "uniqueid $uniqueid deve essere regolato\n"; + echo "lead_id $lead_id deve essere regolato\n"; + echo "\nRedirectVD Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "parkedby $parkedby deve essere regolato\n"; + echo "\nRedirectToPark Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectFromPark Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectName Action non trasmesso\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectNameVmail Action non trasmesso\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "ExtraManica $extrachannel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirect Action non trasmesso\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Non può trovare il congresso vuoto su $server_ip, Redirect ordine non inserito\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Manica $channel non è in tensione su $call_server_ip, Redirect ordine non inserito\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Manica $channel non è in tensione su $server_ip, Redirect ordine non inserito\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra ordine trasmesso per Manica $channel and \nExtraManica $extrachannel\n to $exten su $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra ordine trasmesso per Manica $channel su $call_server_ip and \nExtraManica $extrachannel\n to $exten su $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili è non valido:\n"; + echo "Manica $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirect Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Manica $channel non è in tensione su $server_ip, Redirect ordine non inserito\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect ordine trasmesso per Manica $channel su $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Manica $channel è non valido or queryCID $queryCID è non valido or filename: $filename è non valido, $ACTION ordine non inserito\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Manica $channel non è in tensione su $server_ip, $ACTION ordine non inserito\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION ordine trasmesso per Manica $channel su $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Manica $channel è non valido or exten $exten è non valido or filename: $filename è non valido, $ACTION ordine non inserito\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going su in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION ordine trasmesso per Manica $channel su $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA REGISTRAZIONE DURERÀ FINO A 60 MINUTI\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_it/park_calls_display.php b/LANG_agc/LANG_agc/agc_it/park_calls_display.php new file mode 100644 index 0000000..cf729c1 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Esposizione Parcheggiata Di Chiamate"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten è non valido o protocollo $protocol è non valido\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/vdc_db_query.php b/LANG_agc/LANG_agc/agc_it/vdc_db_query.php new file mode 100644 index 0000000..925812f --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Scritto Di Domanda Della Base di dati"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Scelta Del Gruppo $closer_choice è non valido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Scelta Del Gruppo $closer_choice è stato registrato a user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "TRAMOGGIA VUOTA\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context è non valido\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INCHIAMATA + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "TRAMOGGIA VUOTA\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context è non valido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCHIAMATA + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "CHIAMATA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context è non valido\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID è non valido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "CEPPO NON INSERITO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign è non valido\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserito: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "CEPPO NON INSERITO\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CHIAMATA_LOG Inserito: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "CEPPO NON INSERITO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "CEPPO NON INSERITO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id è non valido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "CEPPO NON INSERITO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagna $campaign è non valido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INCHIAMATA in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INCHIAMATA + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCHIAMATA + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCHIAMATA + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send su to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user su $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten è non valido\n"; + exit; + } +else + { + ##### Insert a TERMINE record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','TERMINE','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation su the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id è non valido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### CHIAMATABACK ENTRY + if ( ($dispo_choice == 'CBHVECCHIO') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' è stato cambiato a ' . $dispo_choice . " Condizione\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id è non valido\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id le informazioni sono state aggiornate\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage è non valido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' è ora nella condizione ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list è non valido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_it/vicidial.php b/LANG_agc/LANG_agc/agc_it/vicidial.php new file mode 100644 index 0000000..50c0c24 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Ora avete annotato fuori. Grazie\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "Web client di VICIMANOPOLA: Re-Inizio attività\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Inizio attività
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:
Inizio attività Dell'Utente:
Parola d'accesso Dell'Utente:
Campagna: $camp_form_code

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Web client di VICIMANOPOLA: Inizio attività Di Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Inizio attività Dell'Utente

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Di Campagna
 
Inizio attività Dell'Utente:
Parola d'accesso Dell'Utente:
Campagna: $camp_form_code

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "Web client di VICIMANOPOLA: Inizio attività\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:
Inizio attività Dell'Utente:
Parola d'accesso Dell'Utente:
Campagna: $camp_form_code

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "Web client di VICIMANOPOLA: Inizio attività Del Telefono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Inizio attività Del Telefono
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La campagna non attiva, prova prego ancora
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "L'inizio attività errato, prova prego ancora
"; + } + } + if ($VDloginDISPLAY) + { + echo "Web client di VICIMANOPOLA: Inizio attività Di Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Di Campagna
 
Inizio attività Dell'Utente:
Parola d'accesso Dell'Utente:
Campagna: $camp_form_code

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "Web client di VICIMANOPOLA: Inizio attività Del Telefono Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Error
 
Spiacente, il vostri inizio attività del telefono e parola d'accesso:
 
Inizio attività Del Telefono:
Parola d'accesso Del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "Web client di VICIMANOPOLA\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed su this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login su phone: $SIP_user alla campagna: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NUOVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "Web client di VICIMANOPOLA: VICIMANOPOLA Inizio attività Di Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Spiacenti, non ci sono cavi nella tramoggia per questa campagna\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inizio attività: \n
"; + echo "Parola d'accesso:
\n"; + echo "Campagna: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Web client di VICIMANOPOLA: VICIMANOPOLA Inizio attività Di Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inizio attività: \n
"; + echo "Parola d'accesso:
\n"; + echo "Campagna: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +TERMINE\n"; ?> +
+
+ + + + + + + + +
VICIMANOPOLASCRIPT   LIVE     ID di sessione: Vive La Chiamata
+
+ + + + +

VICIMANOPOLA
+
+ + + + +
+ + Trasferimento - Congresso
+ PIÙ VICINO INTERNO + LOCAL PIÙ VICINO + CODE + Linea Di Xfer Di Hangup + Hangup Entrambe le Linee + +
+ + Numero da denominare   + secondi   + channel + + OVERRIDE   + D1 + D2 +
+ + Manopola Con Il Cliente + Manopola Del Cliente Del Parco + CHIAMATA DI PERMESSO 3-WAY + Trasferimento Dei Ciechi Della Manopola + Blind Transfer VMail Message +
+
+
+ + + + +
Cavo Dispositioned As:

+ -
+
+
+ + + + + + + +
Chiavi Calde Di Disposizione: + Una volta attivo, premi semplicemente la chiave di tastiera per la:
+ + + + + +
+
+ + +
Nessuno è nella vostra sessione:
+ OK +
+
+ + +
Il cliente ha appeso in su:
+ OK +
+
+ + +

TERMINE
+
+ + +
+
+ + +
 
+
+ + +
Tutti i cambiamenti fatti al cliente che le informazioni qui sotto attualmente non saranno comitted, voi devono cambiare le informazioni del cliente prima di voi hangup la chiamata.
+
+ + +
CHIAMATA DI DISPOSIZIONE :       minimizzi
+ Estremità-de-denomini La Selezione Di Disposizione +
+ SMETTA DI DENOMINARE
+ RISISTEMAZIONE | + PRESENTI +



  +
+
+ + + +
Selezioni una data di chiamata ripetuta :
+ + + Selezioni una data qui sotto   +     + Hour: +   + Minutes: +   + +  
+ + Osservazioni dei CB:

+ + PRESENTI

+ + +

  +
+
+ + +
SELEZIONE DI GRUPPO INBOUND PIÙ VICINA
+ Selezione Di Gruppo Inbound Più vicina +
+ CHIAMATA MESCOLATA(outbound attivato)
+ RISISTEMAZIONE | + PRESENTI +



  +
+
+ + + + + + + + + + + +
TRASFERIMENTO IN TENSIONE DI CHIAMATA
Manica da trasferire: Manica
Estensioni:
Menu Di Estensioni
+
+ Trasmetta all'estensione selezionata

+ Trasmetta alla scatola selezionata del vmail

+ _ trasmett questo numero:


+ RINFRESCHI


+ Di nuovo alla finestra principale

+
Congressi:
(scatti sopra un numero qui sotto per trasmettere ad un congresso)
Trasmetta la mia scanalatura anche
Menu Di Congressi
+
+ + + + +
VICIMANOPOLA SCRIPT
+
+ + + + + + + + + + + + + + + + + +
CONDIZIONE:
+
+Numero Seguente Della Manopola
+ PREVISIONE DEL CAVO
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ALT DEL TELEFONO
";} + + +?> +LIMA DI REGISTRAZIONE:
+
+
+IDENTIFICAZIONE ANNOTAZIONE:
+
+ +Inizi A registrare
+
+Forma Di Fotoricettore
+
+Chiamata Del Parco
+Trasferimento - Congresso
+
+Cliente Di Hangup
+
+Trasmetta DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
secondi:   Manica:   Tempo Di Cust:
Le Informazioni Del Cliente:
Titolo:   In primo luogo:   Mi:  Ultimo:
Indirizzo1:
Indirizzo2:   Indirizzo3:
Città:   Dichiari:   PostCode:
Provincia:   Identificazione Del Fornitore:
Telefono:   DialCode:   Alt. Telefono:
Esposizione:   Email:
Osservazioni:
+ +
+


  + +
+ + + + +
Versione del fotoricettore-cliente di VICIMANOPOLA:     CONFIGURAZIONE:               Assistente:              
+Mostri le informazioni della scanalatura di chiamata di congresso
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +CHIAVI CALDE INATTIVE + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_it/voicemail_check.php b/LANG_agc/LANG_agc/agc_it/voicemail_check.php new file mode 100644 index 0000000..1f1b098 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_it/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Non valido Utentename/Parola d'accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo Di Voicemail"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "scatola del voicemail $vmail_box è non valido\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/active_list_refresh.php b/LANG_agc/LANG_agc/agc_pt/active_list_refresh.php new file mode 100644 index 0000000..10e474a --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/active_list_refresh.php @@ -0,0 +1,446 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Da Lista: "; +if ($ADD==1) {echo "Extensões Vivas";} +if ($ADD==2) {echo "Extensões Ocupadas";} +if ($ADD==3) {echo "Linhas Exteriores";} +if ($ADD==4) {echo "Extensões Locais";} +if ($ADD==5) {echo "Conferências";} +if ($ADD==99999) {echo "AJUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_pt/astguiclient.php b/LANG_agc/LANG_agc/agc_pt/astguiclient.php new file mode 100644 index 0000000..03f0622 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/astguiclient.php @@ -0,0 +1,2874 @@ + 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Você tem registrado agora para fora. Obrigado\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Início de uma sessão\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICISELETOR|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICISELETOR|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Início de uma sessão Do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Início de uma sessão Do Telefone
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Início de uma sessão Do Telefone\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Do Telefone
 
Pesaroso, seus início de uma sessão do telefone e senha não seja:
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Painel PrincipalLinhas Ativas PainelPainel Das ConferênciasVerifique VoicemailVive A Chamada
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Tronco Do Hangup   |   + Tronco Do Hijack   |   + Escuta O Tronco   |   + Refresque   |   + Para trás à janela principal +
+
+ + +
HANGUP LOCAL

+ Menu Local Ativo
+ Local Do Hangup   |   + Local Do Hijack   |   + Escuta O Local   |   + Refresque   |   + Para trás à janela principal +
+
+ + + + + + + +
TRANSFERÊNCIA VIVA DA CHAMADA
Canaleta a ser transferida: Canaleta
Extensões:
Menu Das Extensões
+
+ Emita à extensão selecionada

+ Emita à caixa selecionada do vmail

+ Emita a este número:


+ Refresque


+ Para trás à janela principal

+
Conferências:
(estale sobre um número abaixo para emitir a uma conferência)
Emita minha canaleta demasiado
Menu Das Conferências
+
+ + + + + +
Seletor LOCAL Das Extensões
Telefone que chama-se de: Canaleta
Extensões:
Menu Das Extensões
+
+ Extensão selecionada chamada

+ Caixa selecionada chamada do vmail

+ Refresque


+ Para trás à janela principal

+
+
+ + +
CHAMADAS ESTACIONADAS:
+ Para trás à janela principal

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NOVO:     VELHO:             SELETOR MANUAL       SELETOR
CHAMADAS ESTACIONADAS: 0                EXTENSÕES LOCAIS DO SELETOR
CHAMADAS OUTBOUND :
CHAMADAS INBOUND:
VERSÃO astGUIclient do correia-cliente: CONFIGURAÇÃO:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITOS       edite
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITOS

 
SUBMETA FAVORITOS CHANGES - requires logout
PARA TRÃS À JANELA PRINCIPAL - ignore as mudanças feitas
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | COMEÇO     Refresque a taxa: 1000 ms Mais rapidamente | Mais lento

+
Inicializar..
+
Extensões Ativas
+REFRESQUE | +ORDEM | +
Linhas Exteriores
+REFRESQUE | +ORDEM | +
Extensões Locais
+REFRESQUE | +ORDEM | +
+ Os Dados Vão Aqui

+
+ Os Dados Vão Aqui

Ação Do Tronco +
+ Os Dados Vão Aqui

Ação Local +
+
+ + + + +
+ + +Lista Das Conferências + + + +
+Estale sobre um número de quarto da conferência na esquerda para o +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_pt/call_log_display.php b/LANG_agc/LANG_agc/agc_pt/call_log_display.php new file mode 100644 index 0000000..2a9a075 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/call_log_display.php @@ -0,0 +1,181 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Do Registro Da Chamada"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten é inválido ou protocolo $protocol é inválido\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/conf_exten_check.php b/LANG_agc/LANG_agc/agc_pt/conf_exten_check.php new file mode 100644 index 0000000..c02f22b --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/conf_exten_check.php @@ -0,0 +1,213 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Verificação Da Extensão De Conf"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten é inválido\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanaletaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanaletaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$CanaletaA[$counter] ~"; + # echo "$CanaletaA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten é inválido or Exten $exten é inválido\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferência $conf_exten foi registado a $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/dbconnect.php b/LANG_agc/LANG_agc/agc_pt/dbconnect.php new file mode 100644 index 0000000..1662f18 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/dbconnect.php @@ -0,0 +1,15 @@ + diff --git a/LANG_agc/LANG_agc/agc_pt/inbound_popup.php b/LANG_agc/LANG_agc/agc_pt/inbound_popup.php new file mode 100644 index 0000000..c85eb86 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/inbound_popup.php @@ -0,0 +1,335 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +CHAMADA INBOUND VIVA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

CHAMADA INBOUND VIVA

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid é inválido\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canaleta: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Canaleta=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "COSTUME - \n"; + + echo "
O Número Marcou: $row[8]
Notas: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "EMITA A MEU VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/live_exten_check.php b/LANG_agc/LANG_agc/agc_pt/live_exten_check.php new file mode 100644 index 0000000..f839e3c --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/live_exten_check.php @@ -0,0 +1,263 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Verificação Viva Da Extensão"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten é inválido ou protocolo $protocol é inválido\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $CanaletaA[$loop_count] = "$row[0]"; + $CanaletaB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$CanaletaA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanaletaA: $CanaletaA[$counter] ~"; + echo "CanaletaB: $CanaletaB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$CanaletaA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanaletaA: $CanaletaA[$counter] ~"; + echo "CanaletaB: $CanaletaB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$CanaletaB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanaletaA: $CanaletaA[$counter] ~"; + echo "CanaletaB: $CanaletaB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$CanaletaB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "CanaletaA: $CanaletaA[$counter] ~"; + echo "CanaletaB: $CanaletaB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "CanaletaA: $CanaletaA[$counter] ~"; + echo "CanaletaB: $CanaletaB[$counter] ~"; + echo "CanaletaBtrunk: $CanaletaA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/manager_send.php b/LANG_agc/LANG_agc/agc_pt/manager_send.php new file mode 100644 index 0000000..55983af --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "O Gerente Emite: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AJUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando emitido para Exten $exten Canaleta $channel em $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nOriginateName Action não emitido\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nOriginateNameVmail Action não emitido\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando emitido para Exten $exten Canaleta $channel em $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten é inválido or ext_context $ext_context or queryCID $queryCID é inválido, Hangup comando não introduzido\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or queryCID $queryCID é inválido, Hangup comando não introduzido\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel não está vivo em $call_server_ip, Checking Live Canaleta...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $call_server_ip, Hangup comando não introduzido $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando emitido para Canaleta $channel em $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "auto_dial_level $auto_dial_level deve ser ajustado\n"; + echo "campaign $campaign deve ser ajustado\n"; + echo "uniqueid $uniqueid deve ser ajustado\n"; + echo "lead_id $lead_id deve ser ajustado\n"; + echo "\nRedirectVD Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "parkedby $parkedby deve ser ajustado\n"; + echo "\nRedirectToPark Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectFromPark Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectName Action não emitido\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectNameVmail Action não emitido\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "ExtraCanaleta $extrachannel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirect Action não emitido\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Não pode encontrar a conferência vazia em $server_ip, Redirect comando não introduzido\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canaleta $channel não está vivo em $call_server_ip, Redirect comando não introduzido\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canaleta $channel não está vivo em $server_ip, Redirect comando não introduzido\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando emitido para Canaleta $channel and \nExtraCanaleta $extrachannel\n to $exten em $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando emitido para Canaleta $channel em $call_server_ip and \nExtraCanaleta $extrachannel\n to $exten em $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirect Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $server_ip, Redirect comando não introduzido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando emitido para Canaleta $channel em $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or queryCID $queryCID é inválido or filename: $filename é inválido, $ACTION comando não introduzido\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $server_ip, $ACTION comando não introduzido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando emitido para Canaleta $channel em $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or exten $exten é inválido or filename: $filename é inválido, $ACTION comando não introduzido\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going em in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando emitido para Canaleta $channel em $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n A GRAVAÇÃO DURARà ATÉ 60 MINUTOS\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/LANG_agc/LANG_agc/agc_pt/park_calls_display.php b/LANG_agc/LANG_agc/agc_pt/park_calls_display.php new file mode 100644 index 0000000..ab87a35 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/park_calls_display.php @@ -0,0 +1,136 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Estacionada Das Chamadas"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten é inválido ou protocolo $protocol é inválido\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/vdc_db_query.php b/LANG_agc/LANG_agc/agc_pt/vdc_db_query.php new file mode 100644 index 0000000..3147dc7 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Certificado Da Pergunta Da Base de dados"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Escolha Do Grupo $closer_choice é inválido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Escolha Do Grupo $closer_choice foi registado a user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "FUNIL VAZIO\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INCHAMADA + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "FUNIL VAZIO\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCHAMADA + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "CHAMADA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID é inválido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "REGISTRO NÃO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign é inválido\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Introduzido: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "REGISTRO NÃO ENTRADO\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CHAMADA_LOG Introduzido: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "REGISTRO NÃO ENTRADO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "REGISTRO NÃO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id é inválido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "REGISTRO NÃO ENTRADO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campanha $campaign é inválido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INCHAMADA in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INCHAMADA + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCHAMADA + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCHAMADA + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send em to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user em $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten é inválido\n"; + exit; + } +else + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation em the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id é inválido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### CHAMADABACK ENTRY + if ( ($dispo_choice == 'CBHVELHO') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' foi mudado a ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id é inválido\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id a informação foi atualizada\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage é inválido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' está agora no status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list é inválido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/LANG_agc/LANG_agc/agc_pt/vicidial.php b/LANG_agc/LANG_agc/agc_pt/vicidial.php new file mode 100644 index 0000000..1aaab98 --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "Você tem registrado agora para fora. Obrigado\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "Web client de VICISELETOR: Re-Início de uma sessão\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Web client de VICISELETOR: Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Início de uma sessão Do Usuário

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Da Campanha
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "Web client de VICISELETOR: Início de uma sessão\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "Web client de VICISELETOR: Início de uma sessão Do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Início de uma sessão Do Telefone
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "A campanha nao ativa, tenta por favor outra vez
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "O início de uma sessão incorreto, tenta por favor outra vez
"; + } + } + if ($VDloginDISPLAY) + { + echo "Web client de VICISELETOR: Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Da Campanha
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "Web client de VICISELETOR: Início de uma sessão Do Telefone Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Error
 
Pesaroso, seus início de uma sessão do telefone e senha não seja:
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "Web client de VICISELETOR\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed em this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login em phone: $SIP_user à campanha: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NOVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "Web client de VICISELETOR: VICISELETOR Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Pesaroso, não há nenhuma ligação no funil para esta campanha\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Início de uma sessão: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Web client de VICISELETOR: VICISELETOR Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; echo "
English Español Français Deutsch Italiano Português Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Início de uma sessão: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICISELETORSCRIPT   LIVE     sessão ID: Vive A Chamada
+
+ + + + +

VICISELETOR
+
+ + + + +
+ + Transferência - Conferência
+ MAIS PRÓXIMO INTERNO + LOCAL MAIS PRÓXIMO + CODE + Linha De Xfer Do Hangup + Hangup Ambas as Linhas + +
+ + Número a chamar-se   + segundos   + channel + + OVERRIDE   + D1 + D2 +
+ + Seletor Com Cliente + Seletor Do Cliente Do Parque + CHAMADA DA LICENÇA 3-WAY + Transferência Da Cortina Do Seletor + Blind Transfer VMail Message +
+
+
+ + + + +
Ligação Dispositioned Como:

+ -
+
+
+ + + + + + + +
Chaves Quentes Da Disposição: + Quando ativo, pressione simplesmente a chave de teclado para a:
+ + + + + +
+
+ + +
Noone está em sua sessão:
+ OK +
+
+ + +
O cliente pendurou acima:
+ OK +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Todas as mudanças feitas ao cliente que a informação abaixo neste tempo não será comitted, você devem mudar a informação do cliente antes de você hangup a chamada.
+
+ + +
CHAMADA DA DISPOSIÇÃO :       minimize
+ Extremidade-$$$-CHAME A Seleção Da Disposição +
+ PARE DE CHAMAR-SE
+ RESTAURAÇÃO | + SUBMETA +



  +
+
+ + + +
Selecione uma data da rechamada :
+ + + Selecione uma data abaixo   +     + Hour: +   + Minutes: +   + +  
+ + Comentários dos CB:

+ + SUBMETA

+ + +

  +
+
+ + +
SELEÇÃO DE GRUPO INBOUND MAIS PRÓXIMA
+ Seleção De Grupo Inbound Mais próxima +
+ CHAMADA MISTURADA(outbound ativado)
+ RESTAURAÇÃO | + SUBMETA +



  +
+
+ + + + + + + + + + + +
TRANSFERÊNCIA VIVA DA CHAMADA
Canaleta a ser transferida: Canaleta
Extensões:
Menu Das Extensões
+
+ Emita à extensão selecionada

+ Emita à caixa selecionada do vmail

+ Emita a este número:


+ REFRESQUE


+ Para trás à janela principal

+
Conferências:
(estale sobre um número abaixo para emitir a uma conferência)
Emita minha canaleta demasiado
Menu Das Conferências
+
+ + + + +
VICISELETOR SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUS:
+
+Número Seguinte Do Seletor
+ INSPECÇÃO PRÉVIA DA LIGAÇÃO
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ALT DO TELEFONE
";} + + +?> +LIMA DE GRAVAÇÃO:
+
+
+ID REGISTRO:
+
+ +Comece Gravar
+
+Formulário Da Correia fotorreceptora
+
+Chamada Do Parque
+Transferência - Conferência
+
+Cliente Do Hangup
+
+Emita DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
segundos:   Canaleta:   Tempo De Cust:
Informação Do Cliente:
Título:   Primeiramente:   Mi:  Último:
Endereço1:
Endereço2:   Endereço3:
Cidade:   Estado:   PostCode:
Província:   Vendedor Id:
Telefone:   DialCode:   Alt. Telefone:
Mostra:   Email:
Comentários:
+ +
+


  + +
+ + + + +
Versão do correia-cliente de VICISELETOR:     CONFIGURAÇÃO:               Usuário:              
+Mostre a informação da canaleta da chamada de conferência
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +CHAVES QUENTES INATIVAS + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/LANG_agc/LANG_agc/agc_pt/voicemail_check.php b/LANG_agc/LANG_agc/agc_pt/voicemail_check.php new file mode 100644 index 0000000..bcf92fc --- /dev/null +++ b/LANG_agc/LANG_agc/agc_pt/voicemail_check.php @@ -0,0 +1,130 @@ + 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Inválido Usuárioname/Senha: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Inválido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Verificação De Voicemail"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "caixa do voicemail $vmail_box é inválido\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/MySQL_AST_CREATE_tables.sql b/MySQL_AST_CREATE_tables.sql new file mode 100644 index 0000000..225cf93 --- /dev/null +++ b/MySQL_AST_CREATE_tables.sql @@ -0,0 +1,633 @@ + CREATE TABLE phones ( +extension VARCHAR(100), +dialplan_number VARCHAR(20), +voicemail_id VARCHAR(10), +phone_ip VARCHAR(15), +computer_ip VARCHAR(15), +server_ip VARCHAR(15), +login VARCHAR(15), +pass VARCHAR(10), +status VARCHAR(10), +active ENUM('Y','N'), +phone_type VARCHAR(50), +fullname VARCHAR(50), +company VARCHAR(10), +picture VARCHAR(19), +messages INT(4), +old_messages INT(4), +protocol ENUM('SIP','Zap','IAX2','EXTERNAL') default 'SIP', +local_gmt TINYINT(2) default '-5', +ASTmgrUSERNAME VARCHAR(20) default 'cron', +ASTmgrSECRET VARCHAR(20) default '1234', +login_user VARCHAR(20), +login_pass VARCHAR(20), +login_campaign VARCHAR(10), +park_on_extension VARCHAR(10) default '8301', +conf_on_extension VARCHAR(10) default '8302', +VICIDIAL_park_on_extension VARCHAR(10) default '8303', +VICIDIAL_park_on_filename VARCHAR(10) default 'conf', +monitor_prefix VARCHAR(10) default '8612', +recording_exten VARCHAR(10) default '8309', +voicemail_exten VARCHAR(10) default '8501', +voicemail_dump_exten VARCHAR(20) default '85026666666666', +ext_context VARCHAR(20) default 'default', +dtmf_send_extension VARCHAR(100) default 'local/8500998@default', +call_out_number_group VARCHAR(100) default 'Zap/g2/', +client_browser VARCHAR(100) default '/usr/bin/mozilla', +install_directory VARCHAR(100) default '/usr/local/perl_TK', +local_web_callerID_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_callerid_output.php', +VICIDIAL_web_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_VICIDIAL_output.php', +AGI_call_logging_enabled ENUM('0','1') default '1', +user_switching_enabled ENUM('0','1') default '1', +conferencing_enabled ENUM('0','1') default '1', +admin_hangup_enabled ENUM('0','1') default '0', +admin_hijack_enabled ENUM('0','1') default '0', +admin_monitor_enabled ENUM('0','1') default '1', +call_parking_enabled ENUM('0','1') default '1', +updater_check_enabled ENUM('0','1') default '1', +AFLogging_enabled ENUM('0','1') default '1', +QUEUE_ACTION_enabled ENUM('0','1') default '1', +CallerID_popup_enabled ENUM('0','1') default '1', +voicemail_button_enabled ENUM('0','1') default '1', +enable_fast_refresh ENUM('0','1') default '0', +fast_refresh_rate INT(5) default '1000', +enable_persistant_mysql ENUM('0','1') default '0', +auto_dial_next_number ENUM('0','1') default '1', +VDstop_rec_after_each_call ENUM('0','1') default '1', +DBX_server VARCHAR(15), +DBX_database VARCHAR(15) default 'asterisk', +DBX_user VARCHAR(15) default 'cron', +DBX_pass VARCHAR(15) default '1234', +DBX_port INT(6) default '3306', +DBY_server VARCHAR(15), +DBY_database VARCHAR(15) default 'asterisk', +DBY_user VARCHAR(15) default 'cron', +DBY_pass VARCHAR(15) default '1234', +DBY_port INT(6) default '3306', +outbound_cid VARCHAR(20), +index (server_ip) +); + + CREATE TABLE servers ( +server_id VARCHAR(10) NOT NULL, +server_description VARCHAR(255), +server_ip VARCHAR(15) NOT NULL, +active ENUM('Y','N'), +asterisk_version VARCHAR(20) default '1.0.7', +max_vicidial_trunks SMALLINT(4) default '96', +telnet_host VARCHAR(20) NOT NULL default 'localhost', +telnet_port INT(5) NOT NULL default '5038', +ASTmgrUSERNAME VARCHAR(20) NOT NULL default 'cron', +ASTmgrSECRET VARCHAR(20) NOT NULL default '1234', +ASTmgrUSERNAMEupdate VARCHAR(20) NOT NULL default 'updatecron', +ASTmgrUSERNAMElisten VARCHAR(20) NOT NULL default 'listencron', +ASTmgrUSERNAMEsend VARCHAR(20) NOT NULL default 'sendcron', +local_gmt TINYINT(2) default '-5', +voicemail_dump_exten VARCHAR(20) NOT NULL default '85026666666666', +answer_transfer_agent VARCHAR(20) NOT NULL default '8365', +ext_context VARCHAR(20) NOT NULL default 'default' +); + + + CREATE TABLE live_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +channel_data VARCHAR(100) +); + + CREATE TABLE live_sip_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +channel_data VARCHAR(100) +); + + CREATE TABLE parked_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +parked_by VARCHAR(100), +parked_time DATETIME +); + + CREATE TABLE conferences ( +conf_exten INT(7) UNSIGNED NOT NULL, +server_ip VARCHAR(15) NOT NULL, +extension VARCHAR(100) +); + + CREATE TABLE recording_log ( +recording_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +channel VARCHAR(100), +server_ip VARCHAR(15), +extension VARCHAR(100), +start_time DATETIME, +start_epoch INT(10), +end_time DATETIME, +end_epoch INT(10), +length_in_sec INT(10), +length_in_min DOUBLE(8,2), +filename VARCHAR(50), +location VARCHAR(255), +index (filename) +); + + CREATE TABLE live_inbound ( +uniqueid DOUBLE(18,7) NOT NULL, +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +caller_id VARCHAR(30), +extension VARCHAR(100), +phone_ext VARCHAR(40), +start_time DATETIME, +acknowledged ENUM('Y','N') default 'N', +inbound_number VARCHAR(20), +comment_a VARCHAR(50), +comment_b VARCHAR(50), +comment_c VARCHAR(50), +comment_d VARCHAR(50), +comment_e VARCHAR(50) +); + + CREATE TABLE inbound_numbers ( +extension VARCHAR(30) NOT NULL, +full_number VARCHAR(30) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +inbound_name VARCHAR(30) +); + + CREATE TABLE server_updater ( +server_ip VARCHAR(15) NOT NULL, +last_update DATETIME +); + + CREATE TABLE call_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY UNIQUE NOT NULL, +channel VARCHAR(100), +channel_group VARCHAR(30), +type VARCHAR(10), +server_ip VARCHAR(15), +extension VARCHAR(100), +number_dialed VARCHAR(15), +caller_code VARCHAR(20), +start_time DATETIME, +start_epoch INT(10), +end_time DATETIME, +end_epoch INT(10), +length_in_sec INT(10), +length_in_min DOUBLE(8,2), +index (caller_code), +index (server_ip), +index (channel) +); + + CREATE TABLE park_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY UNIQUE NOT NULL, +status VARCHAR(10), +channel VARCHAR(100), +channel_group VARCHAR(30), +server_ip VARCHAR(15), +parked_time DATETIME, +grab_time DATETIME, +hangup_time DATETIME, +parked_sec INT(10), +talked_sec INT(10), +extension VARCHAR(100), +user VARCHAR(20), +index (parked_time) +); + + CREATE TABLE vicidial_manager ( +man_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +uniqueid DOUBLE(18,7), +entry_date DATETIME, +status ENUM('NEW','QUEUE','SENT','UPDATED','DEAD'), +response ENUM('Y','N'), +server_ip VARCHAR(15) NOT NULL, +channel VARCHAR(100), +action VARCHAR(20), +callerid VARCHAR(20), +cmd_line_b VARCHAR(100), +cmd_line_c VARCHAR(100), +cmd_line_d VARCHAR(100), +cmd_line_e VARCHAR(100), +cmd_line_f VARCHAR(100), +cmd_line_g VARCHAR(100), +cmd_line_h VARCHAR(100), +cmd_line_i VARCHAR(100), +cmd_line_j VARCHAR(100), +cmd_line_k VARCHAR(100), +index (callerid), +index (uniqueid), +index serverstat(server_ip,status) +); + + CREATE TABLE vicidial_list ( +lead_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +entry_date DATETIME, +modify_date TIMESTAMP, +status VARCHAR(6), +user VARCHAR(20), +vendor_lead_code VARCHAR(20), +source_id VARCHAR(6), +list_id INT(8) UNSIGNED, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +called_since_last_reset ENUM('Y','N'), +phone_code VARCHAR(10), +phone_number VARCHAR(10), +title VARCHAR(4), +first_name VARCHAR(30), +middle_initial VARCHAR(1), +last_name VARCHAR(30), +address1 VARCHAR(100), +address2 VARCHAR(100), +address3 VARCHAR(100), +city VARCHAR(50), +state VARCHAR(2), +province VARCHAR(50), +postal_code VARCHAR(10), +country_code VARCHAR(3), +gender ENUM('M','F'), +date_of_birth DATE, +alt_phone VARCHAR(10), +email VARCHAR(70), +security_phrase VARCHAR(100), +comments VARCHAR(255), +called_count INT(8) UNSIGNED NOT NULL default '0', +index (phone_number), +index (list_id), +index (called_since_last_reset), +index (status), +index (gmt_offset_now) +); + + CREATE TABLE vicidial_hopper ( +hopper_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +campaign_id VARCHAR(8), +status ENUM('READY','QUEUE','INCALL','DONE') default 'READY', +user VARCHAR(20), +list_id INT(9) UNSIGNED NOT NULL, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +index (lead_id) +); + + CREATE TABLE vicidial_live_agents ( +live_agent_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +user VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +conf_exten VARCHAR(20), +extension VARCHAR(100), +status ENUM('READY','QUEUE','INCALL','PAUSED','CLOSER') default 'PAUSED', +lead_id INT(9) UNSIGNED NOT NULL, +campaign_id VARCHAR(8), +uniqueid DOUBLE(18,7), +callerid VARCHAR(20), +channel VARCHAR(100), +random_id INT(8) UNSIGNED, +last_call_time DATETIME, +last_update_time TIMESTAMP, +last_call_finish DATETIME, +closer_campaigns TEXT, +call_server_ip VARCHAR(15), +user_level INT(2) default '0', +index (random_id), +index (last_call_time), +index (last_update_time), +index (last_call_finish) +); + + CREATE TABLE vicidial_auto_calls ( +auto_call_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +server_ip VARCHAR(15) NOT NULL, +campaign_id VARCHAR(20), +status ENUM('SENT','RINGING','LIVE','XFER','PAUSED','CLOSER') default 'PAUSED', +lead_id INT(9) UNSIGNED NOT NULL, +uniqueid DOUBLE(18,7), +callerid VARCHAR(20), +channel VARCHAR(100), +phone_code VARCHAR(10), +phone_number VARCHAR(10), +call_time DATETIME, +index (uniqueid), +index (callerid), +index (call_time) +); + + CREATE TABLE vicidial_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY UNIQUE NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id INT(8) UNSIGNED, +campaign_id VARCHAR(8), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(10), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_closer_log ( +closecallid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id INT(8) UNSIGNED, +campaign_id VARCHAR(20), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(10), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_xfer_log ( +xfercallid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id INT(8) UNSIGNED, +campaign_id VARCHAR(20), +call_date DATETIME, +phone_code VARCHAR(10), +phone_number VARCHAR(10), +user VARCHAR(20), +closer VARCHAR(20), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_users ( +user_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +user VARCHAR(20), +pass VARCHAR(20), +full_name VARCHAR(50), +user_level INT(2), +user_group VARCHAR(20), +phone_login VARCHAR(20), +phone_pass VARCHAR(20), +delete_users ENUM('0','1') default '0', +delete_user_groups ENUM('0','1') default '0', +delete_lists ENUM('0','1') default '0', +delete_campaigns ENUM('0','1') default '0', +delete_ingroups ENUM('0','1') default '0', +delete_remote_agents ENUM('0','1') default '0', +load_leads ENUM('0','1') default '0', +campaign_detail ENUM('0','1') default '0', +ast_admin_access ENUM('0','1') default '0', +ast_delete_phones ENUM('0','1') default '0', +delete_scripts ENUM('0','1') default '0', +modify_leads ENUM('0','1') default '0', +hotkeys_active ENUM('0','1') default '0', +change_agent_campaign ENUM('0','1') default '0', +agent_choose_ingroups ENUM('0','1') default '1', +closer_campaigns TEXT, +index (user) +); + + CREATE TABLE vicidial_user_log ( +user_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +user VARCHAR(20), +event VARCHAR(50), +campaign_id VARCHAR(8), +event_date DATETIME, +event_epoch INT(10) UNSIGNED, +index (user) +); + + CREATE TABLE vicidial_user_groups ( +user_group VARCHAR(20) NOT NULL, +group_name VARCHAR(40) NOT NULL +); + + CREATE TABLE vicidial_campaigns ( +campaign_id VARCHAR(8) PRIMARY KEY UNIQUE NOT NULL, +campaign_name VARCHAR(40), +active ENUM('Y','N'), +dial_status_a VARCHAR(6), +dial_status_b VARCHAR(6), +dial_status_c VARCHAR(6), +dial_status_d VARCHAR(6), +dial_status_e VARCHAR(6), +lead_order VARCHAR(20), +park_ext VARCHAR(10), +park_file_name VARCHAR(10), +web_form_address VARCHAR(255), +allow_closers ENUM('Y','N'), +hopper_level ENUM('1','5','10','50','100','200','500') default '1', +auto_dial_level ENUM('0','1','1.1','1.2','1.3','1.4','1.5','1.6','1.7','1.8','1.9','2.0','2.2','2.5','2.7','3.0','3.5','4.0') default '0', +next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','overall_user_level') default 'oldest_call_finish', +local_call_time VARCHAR(20) DEFAULT '9am-9pm', +voicemail_ext VARCHAR(10), +dial_timeout TINYINT UNSIGNED default '60', +dial_prefix VARCHAR(20) default '9', +campaign_cid VARCHAR(10) default '0000000000', +campaign_vdad_exten VARCHAR(20) default '8365', +campaign_rec_exten VARCHAR(20) default '8309', +campaign_recording ENUM('NEVER','ONDEMAND','ALLCALLS') default 'ONDEMAND', +campaign_rec_filename VARCHAR(50) default 'FULLDATE_CUSTPHONE', +campaign_script VARCHAR(10), +get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +am_message_exten VARCHAR(20), +amd_send_to_vmx ENUM('Y','N') default 'N', +xferconf_a_dtmf VARCHAR(50), +xferconf_a_number VARCHAR(50), +xferconf_b_dtmf VARCHAR(50), +xferconf_b_number VARCHAR(50) +); + + CREATE TABLE vicidial_lists ( +list_id INT(8) UNSIGNED PRIMARY KEY UNIQUE NOT NULL, +list_name VARCHAR(30), +campaign_id VARCHAR(8), +active ENUM('Y','N') +); + + CREATE TABLE vicidial_statuses ( +status VARCHAR(6) PRIMARY KEY UNIQUE NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N') +); + + CREATE TABLE vicidial_campaign_statuses ( +status VARCHAR(6) NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N'), +campaign_id VARCHAR(8), +index (campaign_id) +); + + CREATE TABLE vicidial_campaign_hotkeys ( +status VARCHAR(6) NOT NULL, +hotkey VARCHAR(1) NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N'), +campaign_id VARCHAR(8), +index (campaign_id) +); + + CREATE TABLE vicidial_conferences ( +conf_exten INT(7) UNSIGNED NOT NULL, +server_ip VARCHAR(15) NOT NULL, +extension VARCHAR(100) +); + + CREATE TABLE vicidial_phone_codes ( +country_code SMALLINT(5) UNSIGNED, +country CHAR(3), +areacode CHAR(3), +state VARCHAR(4), +GMT_offset VARCHAR(5), +DST enum('Y','N'), +DST_range VARCHAR(8), +geographic_description VARCHAR(30) +); + + CREATE TABLE vicidial_inbound_groups ( +group_id VARCHAR(20) PRIMARY KEY UNIQUE NOT NULL, +group_name VARCHAR(30), +group_color VARCHAR(7), +active ENUM('Y','N'), +web_form_address VARCHAR(255), +voicemail_ext VARCHAR(10), +next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','overall_user_level') default 'oldest_call_finish', +fronter_display ENUM('Y','N') default 'Y', +ingroup_script VARCHAR(10), +get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +xferconf_a_dtmf VARCHAR(50), +xferconf_a_number VARCHAR(50), +xferconf_b_dtmf VARCHAR(50), +xferconf_b_number VARCHAR(50) +); + +CREATE TABLE vicidial_stations ( +agent_station VARCHAR(10) PRIMARY KEY UNIQUE NOT NULL, +phone_channel VARCHAR(100), +computer_ip VARCHAR(15) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +DB_server_ip VARCHAR(15) NOT NULL, +DB_user VARCHAR(15), +DB_pass VARCHAR(15), +DB_port VARCHAR(6) +); + + CREATE TABLE vicidial_remote_agents ( +remote_agent_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +user_start VARCHAR(20), +number_of_lines TINYINT UNSIGNED default '1', +server_ip VARCHAR(15) NOT NULL, +conf_exten VARCHAR(20), +status ENUM('ACTIVE','INACTIVE') default 'INACTIVE', +campaign_id VARCHAR(8), +closer_campaigns TEXT +); + + CREATE TABLE live_inbound_log ( +uniqueid DOUBLE(18,7) NOT NULL, +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +caller_id VARCHAR(30), +extension VARCHAR(100), +phone_ext VARCHAR(40), +start_time DATETIME, +acknowledged ENUM('Y','N') default 'N', +inbound_number VARCHAR(20), +comment_a VARCHAR(50), +comment_b VARCHAR(50), +comment_c VARCHAR(50), +comment_d VARCHAR(50), +comment_e VARCHAR(50), +index (uniqueid), +index (phone_ext), +index (start_time) +); + + CREATE TABLE web_client_sessions ( +extension VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +program ENUM('agc','vicidial','monitor','other') default 'agc', +start_time DATETIME NOT NULL, +session_name VARCHAR(40) UNIQUE NOT NULL +); + + CREATE TABLE server_performance ( +start_time DATETIME NOT NULL, +server_ip VARCHAR(15) NOT NULL, +sysload INT(6) NOT NULL, +freeram SMALLINT(5) UNSIGNED NOT NULL, +usedram SMALLINT(5) UNSIGNED NOT NULL, +processes SMALLINT(4) UNSIGNED NOT NULL, +channels_total SMALLINT(4) UNSIGNED NOT NULL, +trunks_total SMALLINT(4) UNSIGNED NOT NULL, +clients_total SMALLINT(4) UNSIGNED NOT NULL, +clients_zap SMALLINT(4) UNSIGNED NOT NULL, +clients_iax SMALLINT(4) UNSIGNED NOT NULL, +clients_local SMALLINT(4) UNSIGNED NOT NULL, +clients_sip SMALLINT(4) UNSIGNED NOT NULL, +live_recordings SMALLINT(4) UNSIGNED NOT NULL, +cpu_user_percent SMALLINT(3) UNSIGNED NOT NULL default '0', +cpu_system_percent SMALLINT(3) UNSIGNED NOT NULL default '0', +cpu_idle_percent SMALLINT(3) UNSIGNED NOT NULL default '0' +); + + CREATE TABLE vicidial_agent_log ( +agent_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE NOT NULL, +user VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +event_time DATETIME, +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(8), +pause_epoch INT(10) UNSIGNED, +pause_sec SMALLINT(5) UNSIGNED default '0', +wait_epoch INT(10) UNSIGNED, +wait_sec SMALLINT(5) UNSIGNED default '0', +talk_epoch INT(10) UNSIGNED, +talk_sec SMALLINT(5) UNSIGNED default '0', +dispo_epoch INT(10) UNSIGNED, +dispo_sec SMALLINT(5) UNSIGNED default '0', +status VARCHAR(6) +); + + CREATE TABLE vicidial_scripts ( +script_id VARCHAR(10) PRIMARY KEY UNIQUE NOT NULL, +script_name VARCHAR(50), +script_comments VARCHAR(255), +script_text TEXT, +active ENUM('Y','N') +); + + CREATE TABLE phone_favorites ( +extension VARCHAR(100), +server_ip VARCHAR(15), +extensions_list TEXT +); + + CREATE TABLE vicidial_callbacks ( +callback_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED, +list_id INT(8) UNSIGNED, +campaign_id VARCHAR(8), +status VARCHAR(10), +entry_time DATETIME, +callback_time DATETIME, +modify_date TIMESTAMP, +user VARCHAR(20), +recipient ENUM('USERONLY','ANYONE'), +comments VARCHAR(255), +index (lead_id), +index (status), +index (callback_time) +); diff --git a/VD_amd.agi b/VD_amd.agi new file mode 100644 index 0000000..8adf0e8 --- /dev/null +++ b/VD_amd.agi @@ -0,0 +1,368 @@ +#!/usr/bin/perl +# +# VD_amd.agi version 0.3 +# +# NOTE: This script is only needed with app_amd enabled systems +# +# runs after a call goes through AMD in extensions.conf to send the call on to +# it's proper destination +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +# exten => 8369,1,AGI(call_log.agi,${EXTEN}) +# exten => 8369,2,(AMD),AMD +# exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +# exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,7,Hangup +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60206-1434 first build +# 60207-1205 added database records entries/modifications +# 60207-1507 added ability to send AMs to campaign-defined message to leave + + +$V = 0; # set to 1 for verbose mode +$M = 0; # set to 1 for 2 line messages mode +$A = 1; # set to 1 for AMD output messages mode +$AMD_LOG = 1; # set to 1 for logfile + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1; $calleridnum = $callerid;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); +$VD_lead_id = $CIDlead_id; + +if ($V) {print STDERR "\nVD_amd : $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VD amd START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|$calleridname|\n";} + + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + + +$AMDSTATUS = $AGI->get_variable(AMDSTATUS); +$AMDCAUSE = $AGI->get_variable(AMDCAUSE); + +if ($A) {print STDERR "AAAAA AMD results: |$AMDSTATUS|$AMDCAUSE|\n";} + +# AAAAA AMD results: |AMD_PERSON|AMD_HUMAN-300-300| +# AAAAA AMD results: |AMD_MACHINE|AMD_LONGGREETING-1500-1500| + + +if ($AMD_LOG) + { + open(Lout, ">>/home/cron/AMD_log.txt") + || die "Can't open /home/cron/AMD_log.txt: $!\n"; + print Lout "$now_date|$VD_lead_id| |$AMDSTATUS|$AMDCAUSE|$calleridnum|\n"; + close(Lout); + } + + +################################################################################## +########## AMD says it's a person so exit and go on to transfer scripts ########## +if ($AMDSTATUS =~ /PERSON|NOTSURE|HANGUP/) +{ + if ($A) {print STDERR " AMD exiting\n";} + exit; +} + +else +{ +################################################################################ +########## AMD says it's a machine so modify statuses and hangup call ########## +########## something will go here later for leaving a message on AMs ########## +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +########## FIND ext_context from the servers table ########## +$stmtA = "SELECT ext_context FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBext_context = "$record->[1]"; + if ($DBext_context) {$ext_context = $DBext_context;} + } + } + +########## FIND vicidial_auto_calls record ########## +$stmtA = "SELECT campaign_id,phone_code,phone_number FROM vicidial_auto_calls where callerid='$callerid' order by auto_call_id desc limit 1;"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $VD_campaign_id = "$record->[0]"; + $VD_phone_code = "$record->[1]"; + $VD_phone_number = "$record->[2]"; + } + } + +########## UPDATE vicidial_list ########## +$stmtA = "UPDATE vicidial_list set status='A' where lead_id = '$VD_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$VD_lead_id\n";} + +########## DELETE vicidial_auto_calls entry ########## +$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by auto_call_id desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAC record deleted: |$affected_rows| |$VD_lead_id|$uniqueid|$VD_callerid|$server_ip\n";} + +########## FIND AND UPDATE vicidial_log ########## +$stmtA = "SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); + $epc_countCUSTDATA=0; +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $VD_start_epoch = "$record->[0]"; + $epc_countCUSTDATA++; + } + } +if (!$epc_countCUSTDATA) + { + if($M){print STDERR "\nVD amd: no VDL record found: $uniqueid $calleridname $VD_lead_id $uniqueid\n";} + $end_epoch = ($now_date_epoch + 3); + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch) values('$uniqueid','$VD_lead_id','$VD_campaign_id','$now_date','$now_date_epoch','A','$VD_phone_code','$VD_phone_number','VDAD','N','3','$end_epoch')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + } +else + { + $VD_seconds = ($now_date_epoch - $VD_start_epoch); + $stmtA = "UPDATE vicidial_log set status='A',end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid|\n";} + } + + +### Grab vmail forward message values from the database +$stmtA = "SELECT am_message_exten,amd_send_to_vmx FROM vicidial_campaigns where campaign_id = '$VD_campaign_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DB_am_message_exten = "$record->[0]"; + $DB_amd_send_to_vmx = "$record->[1]"; + } + } + +if ($M) {print STDERR "-- AMD campaign values: |$VD_campaign_id|$DB_am_message_exten|$DB_amd_send_to_vmx|\n";} + +if ( ($DB_amd_send_to_vmx =~ /Y/) && (length($DB_am_message_exten) > 0) ) + { + $stmtA = "UPDATE vicidial_log set status='AM' where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log AM update: |$affected_rows|$uniqueid|\n";} + + $stmtA = "UPDATE vicidial_list set status='AM' where lead_id='$VD_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list AM update: |$affected_rows|$uniqueid|\n";} + + print STDERR "\nexiting the AMD app, transferring call to $DB_am_message_exten"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DB_am_message_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + exit; + } + +$dbhA->close; + +$AGI->hangup($channel); + +exit; +} + + + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/VD_amd_post.agi b/VD_amd_post.agi new file mode 100644 index 0000000..f15bb59 --- /dev/null +++ b/VD_amd_post.agi @@ -0,0 +1,239 @@ +#!/usr/bin/perl +# +# VD_amd_post.agi version 0.1 +# +# NOTE: This script is only needed with app_amd enabled systems +# +# runs after a call goes through AMD in extensions.conf to send the call on to +# it's proper destination +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +# exten => 8369,1,AGI(call_log.agi,${EXTEN}) +# exten => 8369,2,(AMD),AMD +# exten => 8369,3,AGI(VD.agi,${EXTEN}) +# exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,7,Hangup +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60217-1119 first build +# + +$V = 0; # set to 1 for verbose mode +$M = 0; # set to 1 for 2 line messages mode +$A = 1; # set to 1 for AMD output messages mode +$AMD_LOG = 0; # set to 1 for logfile + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); +$VD_lead_id = $CIDlead_id; + +if ($V) {print STDERR "\nVD_amd_post : $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VD amd START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|$calleridname|\n";} + + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + + + + + + + + + + + +################################################################################ +########## AMD says it's a machine so modify statuses and hangup call ########## +########## something will go here later for leaving a message on AMs ########## +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +$stmtA = "UPDATE vicidial_log set status='AL' where lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_log AM update: |$affected_rows|$uniqueid|\n";} + +$stmtA = "UPDATE vicidial_list set status='AL' where lead_id='$VD_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_list AM update: |$affected_rows|$uniqueid|\n";} + + + +$dbhA->close; + + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/VD_hangup.agi b/VD_hangup.agi new file mode 100644 index 0000000..2641592 --- /dev/null +++ b/VD_hangup.agi @@ -0,0 +1,306 @@ +#!/usr/bin/perl +# +# VD_hangup.agi version 0.2 +# +# NOTE: This script is only needed on Asterisk 1.2.X and higher systems +# +# runs when a call hangs up in the second priority behind call_log. This script +# will lookup the uniqueid of the call and/or the callerIDname and update tables +# if it is a VICIDIAL inbound or outbound call that hungup before sent to agent +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => h,1,DeadAGI(call_log.agi,${EXTEN}) +# exten => h,2,DeadAGI(VD_hangup.agi,${EXTEN}) +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60203-1218 - fixed calleridname issue with 1.2 tree for custom CID +# 60314-1250 - Altered to allow for ignoring of AGI-defined status +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nVD_hangup : $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VD hangup START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|$calleridname|\n";} + + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +########## FIND AND DELETE vicidial_auto_calls ########## +$stmtA = "SELECT lead_id,callerid FROM vicidial_auto_calls where uniqueid = '$uniqueid' limit 1;"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); + $rec_countCUSTDATA=0; +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $VD_lead_id = "$record->[0]"; + $VD_callerid = "$record->[1]"; + $rec_countCUSTDATA++; + } + } + +if (!$rec_countCUSTDATA) + { + if($M){print STDERR "\nVD hangup: no VDAC record found: $uniqueid $calleridname\n";} + exit; + } + +$stmtA = "DELETE FROM vicidial_auto_calls where uniqueid='$uniqueid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAC record deleted: |$affected_rows| |$VD_lead_id|$uniqueid|$VD_callerid|$server_ip\n";} + + +########## FIND AND UPDATE vicidial_log ########## +$stmtA = "SELECT start_epoch,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$VD_lead_id' limit 1;"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); + $epc_countCUSTDATA=0; +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $VD_start_epoch = "$record->[0]"; + $VD_status = "$record->[1]"; + $epc_countCUSTDATA++; + } + } +if (!$epc_countCUSTDATA) + { + if($M){print STDERR "\nVD hangup: no VDL record found: $uniqueid $calleridname $VD_lead_id $uniqueid\n";} + exit; + } +$VD_seconds = ($now_date_epoch - $VD_start_epoch); + +$SQL_status=''; +if ($VD_status =~ /^NA$|^NEW$|^QUEUE$|^XFER$/) + { + $SQL_status = "status='DROP',"; + + ########## FIND AND UPDATE vicidial_list ########## + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$VD_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$VD_lead_id\n";} + } + +$stmtA = "UPDATE vicidial_log set $SQL_status end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid|\n";} + + + + +########## FIND AND UPDATE vicidial_closer_log ########## +$stmtA = "SELECT closecallid,start_epoch FROM vicidial_closer_log where lead_id='$VD_lead_id' order by closecallid desc limit 1;"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); + $epc_countCUSTDATA=0; +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $closecallid = "$record->[0]"; + $VD_start_epoch = "$record->[1]"; + $epc_countCUSTDATA++; + } + } +if (!$epc_countCUSTDATA) + { + if($M){print STDERR "\nVD hangup: no VDCL record found: $uniqueid $calleridname $VD_lead_id $uniqueid\n";} + exit; + } +$VD_seconds = ($now_date_epoch - $VD_start_epoch); +$stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where closecallid = '$closecallid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDCL update: |$affected_rows|$uniqueid|$closecallid|\n";} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/VICIDIAL_IN_new_leads_file.pl b/VICIDIAL_IN_new_leads_file.pl new file mode 100644 index 0000000..dec56e0 --- /dev/null +++ b/VICIDIAL_IN_new_leads_file.pl @@ -0,0 +1,309 @@ +#!/usr/bin/perl +# +# VICIDIAL_IN_new_leads_file.pl version 0.2 +# +# DESCRIPTION: +# script lets you insert leads into the vicidial_list table from a TAB-delimited +# lead file that is in the proper format. (for format see --help) +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; + + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- VICIDIAL_IN_new_leads_file.pl --\n\n"; +print "This program is designed to take a tab delimited file and import it into the VICIDIAL system. \n\n"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-h] = this help screen\n\n"; + print "This script takes in lead files in the following order when they are placed in the /home/cron/VICIDIAL/LEADS_IN directory to be imported into the vicidial_list table:\n\n"; + print "vendor_lead_code|source_code|list_id|phone_code|phone_number|title|first_name|middle|last_name|address1|address2|address3|city|state|province|postal_code|country|gender|date_of_birth|alt_phone|email|security_phrase|COMMENTS\n\n"; + print "3857822|31022|105|01144|1625551212|MRS|B||BURTON|249 MUNDON ROAD|MALDON|ESSEX||||CM9 6PW|UK||||||COMMENTS\n\n"; + } + else + { + if ($args =~ /-q/i) + { + $q=1; + } + if ($args =~ /-t/i) + { + $T=1; + $TEST=1; + print "\n-----TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +$suf = '.txt'; +$people_packages_id_update=''; +$dir1 = '/home/cron/VICIDIAL/LEADS_IN'; +$dir2 = '/home/cron/VICIDIAL/LEADS_IN/DONE'; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + $person_id_delete = ''; + $transaction_id_delete = ''; + + if (length($FILES[$i]) > 4) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if (!$q) {print "$FILES[$i] $size1\n";} + sleep(2); + $size2 = (-s "$dir1/$FILES[$i]"); + if (!$q) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /^TRANSFERRED/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $GOODfname = $FILES[$i]; + $FILES[$i] =~ s/ /_/gi; + $FILES[$i] =~ s/\(|\)|\||\\|\/|\'|\"|//gi; + rename("$dir1/$GOODfname","$dir1/$FILES[$i]"); + $FILEname = $FILES[$i]; + + $Routfile = "ERR_$source$FILES[$i]"; + $Soutfile = "STS_$source$FILES[$i]"; + $Toutfile = "SQL_$source$FILES[$i]"; + $Doutfile = "DEL_$source$FILES[$i]"; + + `cp -f $dir1/$FILES[$i] $dir2/$source$FILES[$i]`; + + ### open the in file for reading ### + open(infile, "$dir2/$source$FILES[$i]") + || die "Can't open $source$FILES[$i]: $!\n"; + + ### open the error out file for writing ### + open(Rout, ">>$dir2/$Routfile") + || die "Can't open $Routfile: $!\n"; + + ### open the error out file for writing ### + open(Tout, ">>$dir2/$Toutfile") + || die "Can't open $Toutfile: $!\n"; + + ### open the error out file for writing ### + open(Dout, ">>$dir2/$Doutfile") + || die "Can't open $Doutfile: $!\n"; + + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +use Net::MySQL; + + my $dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + + + print "\n\n SQL inserts will be put in $Toutfile\n\n"; + + $a=0; ### each line of input file counter ### + $b=0; ### status of 'APPROVED' counter ### + $c=0; ### status of 'DECLINED' counter ### + $d=0; ### status of 'REFERRED' counter ### + $e=0; ### status of 'ERROR' counter ### + $f=0; ### number of modified packages ### + $g=0; ### number of credits ### + + $multi_insert_counter=0; + $multistmt=''; + + while () + { + + #print "$a| $number\n"; + $number = $_; + chomp($number); +# $number =~ s/,/\|/gi; + $number =~ s/\t/\|/gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; + $number =~ s/\",,,,\"/\|\|\|\|/gi; + $number =~ s/\",,,\"/\|\|\|/gi; + $number =~ s/\",,\"/\|\|/gi; + $number =~ s/\",\"/\|/gi; + $number =~ s/\"//gi; + @m = split(/\|/, $number); + +# This is the format for the lead files +#3857822|31022|105|01144|1625551212|MRS|B||BURTON|249 MUNDON ROAD|MALDON|ESSEX||||CM9 6PW|UK||||||COMMENTS + + + $entry_date = "$pulldate0"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $m[0]; chomp($vendor_lead_code); + $source_code = $m[1]; chomp($source_code); $source_id = $source_code; + $list_id = $m[2]; chomp($list_id); + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = $m[3]; chomp($phone_code); $phone_code =~ s/\D//gi; + $phone_number = $m[4]; chomp($phone_number); $phone_number =~ s/\D//gi; + $title = $m[5]; chomp($title); + $first_name = $m[6]; chomp($first_name); + $middle_initial = $m[7]; chomp($middle_initial); + $last_name = $m[8]; chomp($last_name); + $address1 = $m[9]; chomp($address1); + $address2 = $m[10]; chomp($address2); + $address3 = $m[11]; chomp($address3); + $city = $m[12]; chomp($city); + $state = $m[13]; chomp($state); + $province = $m[14]; chomp($province); + $postal_code = $m[15]; chomp($postal_code); + $country = $m[16]; chomp($country); + $gender = $m[17]; + $date_of_birth = $m[18]; + $alt_phone = $m[19]; + $email = $m[20]; + $security_phrase = $m[21]; + $comments = $m[22]; + + + if (length($phone_number)>8) + { + + if ($multi_insert_counter > 8) + { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0');"; + if($DB){print STDERR "\n|$stmtZ|\n";} + if (!$T) {$dbhA->query($stmtZ); } # or die "Couldn't execute query: |$stmtA|\n"; + + $multistmt=''; + $multi_insert_counter=0; + $c++; + } + else + { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0'),"; + $multi_insert_counter++; + } + + $b++; + } + else + { + print "BAD Home_Phone: $phone|$vendor_id"; + $e++; + } + + $a++; + + if ($a =~ /100$/i) {print STDERR "0 $a\r";} + if ($a =~ /200$/i) {print STDERR "+ $a\r";} + if ($a =~ /300$/i) {print STDERR "| $a\r";} + if ($a =~ /400$/i) {print STDERR "\\ $a\r";} + if ($a =~ /500$/i) {print STDERR "- $a\r";} + if ($a =~ /600$/i) {print STDERR "/ $a\r";} + if ($a =~ /700$/i) {print STDERR "| $a\r";} + if ($a =~ /800$/i) {print STDERR "+ $a\r";} + if ($a =~ /900$/i) {print STDERR "0 $a\r";} + if ($a =~ /000$/i) {print "$a|$b|$c|$d|$e|$phone_number|\n";} + + } + + if (length($multistmt) > 10) + { + chop($multistmt); + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt;"; + if($DB){print STDERR "\n|$stmtZ|\n";} + if (!$T) {$dbhA->query($stmtZ); } # or die "Couldn't execute query: |$stmtA|\n"; + + $multistmt=''; + $multi_insert_counter=0; + $c++; + } + + ### open the stats out file for writing ### + open(Sout, ">>/$dir2/$Soutfile") + || die "Can't open $Soutfile: $!\n"; + + + ### close file handler and DB connections ### + print "\n\nTOTALS FOR $FILEname:\n"; + print "Transactions sent:$a\n"; + print "INSERTED: $b\n"; + print "INSERT STATEMENTS:$c\n"; + print "ERROR: $e\n"; +# print "Modified PAID NS: $f\n"; +# print "Credits: $g\n\n"; + + print Sout "\nTOTALS FOR $FILEname:\n"; + print Sout "Transactions sent:$a\n"; + print Sout "INSERTED: $b\n"; + print Sout "INSERT STATEMENTS:$c\n"; + print Sout "ERROR: $e\n"; +# print Sout "Modified PAID NS: $f\n"; +# print Sout "Credits: $g\n\n"; + + close(infile); + close(Rout); + chmod 0777, "$dir2/$Routfile"; + close(Sout); + chmod 0777, "$dir2/$Soutfile"; + close(Tout); + chmod 0777, "$dir2/$Toutfile"; + close(Dout); + chmod 0777, "$dir2/$Doutfile"; + + if (!$T) {`mv -f $dir1/$FILEname $dir2/$FILEname`;} + + } + } + $i++; +} + + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; diff --git a/VICIDIAL_web/AST_CLOSERstats.php b/VICIDIAL_web/AST_CLOSERstats.php new file mode 100644 index 0000000..4e25abc --- /dev/null +++ b/VICIDIAL_web/AST_CLOSERstats.php @@ -0,0 +1,369 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$query_date=$_GET["query_date"]; if (!$query_date) {$query_date=$_POST["query_date"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_VDADstats.php b/VICIDIAL_web/AST_VDADstats.php new file mode 100644 index 0000000..6358c6d --- /dev/null +++ b/VICIDIAL_web/AST_VDADstats.php @@ -0,0 +1,390 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$query_date=$_GET["query_date"]; if (!$query_date) {$query_date=$_POST["query_date"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='$group' and status='NA' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+$NApercent = (($NAcalls / $TOTALcalls) * 100);
+$NApercent = round($NApercent, 0);
+
+$average_na_seconds = ($row[1] / $row[0]);
+$average_na_seconds = round($average_na_seconds, 0);
+$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+
+echo "Total NA calls -Busy,Disconnect,BTvoicemail:  $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and  campaign_id='$group' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='$group' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_VICIDIAL_hopperlist.php b/VICIDIAL_web/AST_VICIDIAL_hopperlist.php new file mode 100644 index 0000000..be9aa76 --- /dev/null +++ b/VICIDIAL_web/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,135 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} +if (!$server_ip) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+echo "|      | LEAD_ID   | PHONE NUM  | STATE | STATUS | COUNT | GMT    |\n";
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now from vicidial_hopper,vicidial_list where vicidial_hopper.CAMPAIGN_ID='$group' and vicidial_hopper.lead_id=vicidial_list.lead_id order by hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+
+	echo "| $FMT_i | $lead_id | $phone_number | $state | $status | $count | $gmt |\n";
+
+	$i++;
+	}
+
+echo "+------+-----------+------------+-------+--------+-------+--------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_admin_log_display.php b/VICIDIAL_web/AST_admin_log_display.php new file mode 100644 index 0000000..0b93061 --- /dev/null +++ b/VICIDIAL_web/AST_admin_log_display.php @@ -0,0 +1,107 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$query_date=$_GET["query_date"]; if (!$query_date) {$query_date=$_POST["query_date"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration +### AST_admin_log_display.php +### +### CHANGES +### 50325-0932 - First build +### 51123-1443 - removed globals=on requirement + + +$version = '0.0.1'; +$build = '50325-0932'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) + {$GREP_DATE = date("D, j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_agent_performance.php b/VICIDIAL_web/AST_agent_performance.php new file mode 100644 index 0000000..af13387 --- /dev/null +++ b/VICIDIAL_web/AST_agent_performance.php @@ -0,0 +1,205 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$query_date=$_GET["query_date"]; if (!$query_date) {$query_date=$_POST["query_date"];} +$shift=$_GET["shift"]; if (!$shift) {$shift=$_POST["shift"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='$group' group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+--------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/VICIDIAL_web/AST_agent_performance_detail.php b/VICIDIAL_web/AST_agent_performance_detail.php
new file mode 100644
index 0000000..8c7ec4c
--- /dev/null
+++ b/VICIDIAL_web/AST_agent_performance_detail.php
@@ -0,0 +1,379 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$query_date=$_GET["query_date"];	if (!$query_date) {$query_date=$_POST["query_date"];}
+$group=$_GET["group"];				if (!$group) {$group=$_POST["group"];}
+$shift=$_GET["shift"];				if (!$shift) {$shift=$_POST["shift"];}
+$submit=$_GET["submit"];			if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];			if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 03:45:00";   
+	$query_date_END = "$query_date 15:15:00";
+	$time_BEGIN = "03:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:15:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID     | CALLS  | TIME   | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG| A    | B    | DC   | DNC  | N    | NI   | CB   | SALE |\n";
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='$group' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by full_name order by calls desc limit 1000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtime=($TOTtime + $row[1] + $row[5] + $row[7] + $row[9]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$TOTtotWAIT=($TOTtotWAIT + $row[7]);
+	$TOTtotPAUSE=($TOTtotPAUSE + $row[5]);
+	$TOTtotDISPO=($TOTtotDISPO + $row[9]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-6s", $row[3]);
+	$USERtime =	($row[1] + $row[5] + $row[7] + $row[9]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+	$USERtotPAUSE =	$row[5];
+	$USERavgPAUSE =	$row[6];
+	$USERtotWAIT =	$row[7];
+	$USERavgWAIT =	$row[8];
+	$USERtotDISPO =	$row[9];
+	$USERavgDISPO =	$row[10];
+
+	$USERtime_M = ($USERtime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS[$i] =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($USERtotPAUSE / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS[$i] =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($USERavgPAUSE / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS[$i] =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($USERtotWAIT / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS[$i] =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($USERavgWAIT / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS[$i] =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($USERtotDISPO / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS[$i] =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($USERavgDISPO / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS[$i] =		sprintf("%6s", $USERavgDISPO_MS);
+
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; $ctCB[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='$group' group by status;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if (($row[1] == 'CALLBK') || ($row[1] == 'CBHOLD') ) {$ctCB[$k]=sprintf("%-4s", $row[0]);	$TOT_CB = ($TOT_CB + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtime_MS[$k]| $pfUSERtotPAUSE_MS[$k] | $pfUSERavgPAUSE_MS[$k] | $pfUSERtotWAIT_MS[$k] | $pfUSERavgWAIT_MS[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $pfUSERtotDISPO_MS[$k] | $pfUSERavgDISPO_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctCB[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = round($TOTtime_M, 2);
+	$TOTtime_M_int = intval("$TOTtime_M");
+	$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
+	$TOTtime_S = ($TOTtime_S * 60);
+	$TOTtime_S = round($TOTtime_S, 0);
+	if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%7s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>7) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%7s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>7) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%7s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>7) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%7s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>7) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+	
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_CB = sprintf("%-5s", $TOT_CB);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                  | $TOTcalls| $TOTtime_MS| $TOTtotPAUSE_MS| $TOTavgPAUSE_MS | $TOTtotWAIT_MS| $TOTavgWAIT_MS | $TOTtotTALK_MS| $TOTavgTALK_MS | $TOTtotDISPO_MS| $TOTavgDISPO_MS | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_CB| $TOT_SALE|\n";
+echo "+--------------------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/VICIDIAL_web/AST_agent_time_sheet.php b/VICIDIAL_web/AST_agent_time_sheet.php
new file mode 100644
index 0000000..16f2f7e
--- /dev/null
+++ b/VICIDIAL_web/AST_agent_time_sheet.php
@@ -0,0 +1,256 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$agent=$_GET["agent"];						if (!$agent) {$agent=$_POST["agent"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$calls_summary=$_GET["calls_summary"];		if (!$calls_summary) {$calls_summary=$_POST["calls_summary"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];					if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+# query_date - 2005-05-10
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and user='$agent' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/VICIDIAL_web/AST_parkstats.php b/VICIDIAL_web/AST_parkstats.php
new file mode 100644
index 0000000..d555f5a
--- /dev/null
+++ b/VICIDIAL_web/AST_parkstats.php
@@ -0,0 +1,369 @@
+    LICENSE: GPLv2
+###
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+$group=$_GET["group"];						if (!$group) {$group=$_POST["group"];}
+$query_date=$_GET["query_date"];			if (!$query_date) {$query_date=$_POST["query_date"];}
+$submit=$_GET["submit"];					if (!$submit) {$submit=$_POST["submit"];}
+$SUBMIT=$_GET["SUBMIT"];					if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!$query_date) {$query_date = $NOW_DATE;}
+
+$stmt="select distinct channel_group from park_log;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "VICIDIAL: Park Stats\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A GROUP AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Park Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls taken in this Group:              $TOTALcalls\n";
+echo "Average Hold Time(seconds) for all Calls:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Dropped Calls:                          $DROPcalls  $DROPpercent%\n";
+echo "Average Hold Time(seconds) for Dropped Calls: $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select park_log.user,full_name,count(*),sum(talked_sec),avg(talked_sec) from park_log,vicidial_users where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='$group' and park_log.user is not null and talked_sec is not null and talked_sec > 4 and park_log.user=vicidial_users.user group by park_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='$group' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_server_performance.php b/VICIDIAL_web/AST_server_performance.php new file mode 100644 index 0000000..1a65284 --- /dev/null +++ b/VICIDIAL_web/AST_server_performance.php @@ -0,0 +1,283 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$query_date=$_GET["query_date"]; if (!$query_date) {$query_date=$_POST["query_date"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$shift=$_GET["shift"]; if (!$shift) {$shift=$_POST["shift"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +# path from root to where ploticus files will be stored +$DOCroot = "$WeBServeRRooT/vicidial/ploticus/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!$query_date) {$query_date = $NOW_DATE;} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +# query_date - 2005-05-10 +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:32:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:15:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:32:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:15:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$HIGHload =	sprintf("%10s", $row[0]);
+$HIGHmulti = intval($HIGHload / 100);
+#$HIGHmulti = ($HIGHload / 100);
+
+$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$USEDram =	sprintf("%10s", $row[0]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365') and  start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average channels in use for server:       $AVGchannels\n";
+echo "Average load for server:                  $AVGload\n";
+echo "Peak load for server:                     $HIGHload\n";
+#echo "Peak used memory for server (in MB):      $USEDram\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHload\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc 30 minutes\n";
+$HTMcontent .= "minorticinc: 5 minutes\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/VICIDIAL_web/AST_timeonVDAD.php b/VICIDIAL_web/AST_timeonVDAD.php new file mode 100644 index 0000000..3f42e03 --- /dev/null +++ b/VICIDIAL_web/AST_timeonVDAD.php @@ -0,0 +1,232 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# changes: +# 50406-0920 Added Paused agents < 1 min (Chris Doyle) + + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
+echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	$agentcount=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED",$row[4]))
+			{
+			$row[3]='';
+			$row[5]=' - WAITING - ';
+			$row[6]=$row[7];
+			}
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$sessionid =		sprintf("%-9s", $row[2]);
+		$channel =			sprintf("%-10s", $row[3]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[4]);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 5) {$G=''; $EG='';}
+		if ($call_time_M_int >= 10) {$G=''; $EG='';}
+		if (eregi("PAUSED",$row[4])) 
+			{
+			if ($call_time_M_int >= 1) 
+				{$i++; continue;} 
+			else
+				{$G=''; $EG='';}
+			}
+
+		$agentcount++;
+		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
+echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 10) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 10) {$cc=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-8s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$start_time =		sprintf("%-19s", $row[5]);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + diff --git a/VICIDIAL_web/AST_timeonVDAD_closer.php b/VICIDIAL_web/AST_timeonVDAD_closer.php new file mode 100644 index 0000000..2dab669 --- /dev/null +++ b/VICIDIAL_web/AST_timeonVDAD_closer.php @@ -0,0 +1,289 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
\n\n";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                                        $NOW_TIME\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] =		sprintf("%-10s", $row[0]);
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where uniqueid='$uniqueid[$i]' and server_ip='$server_ip';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='$server_ip' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_timeonVDADall.php b/VICIDIAL_web/AST_timeonVDADall.php new file mode 100644 index 0000000..8edd342 --- /dev/null +++ b/VICIDIAL_web/AST_timeonVDADall.php @@ -0,0 +1,272 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# changes: +# 50406-0920 Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 Modified layout and info to show all servers in a vicidial system + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$RR=$_GET["RR"]; if (!$RR) {$RR=$_POST["RR"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!$RR) {$RR=40;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL: Realtime Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "                   \n"; +echo "STOP | GO \n"; +echo "\n\n"; + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order from vicidial_campaigns where campaign_id='$group';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); + +echo "
"; +echo "DIAL LEVEL: $row[0]         "; +echo "STATUSES: $row[1], $row[2], $row[3], $row[4], $row[5]         "; +echo "ORDER: $row[6]"; +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if (eregi("CLOSER",$group)) + {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and (campaign_id='$group' or campaign_id LIKE \"CL_%\");";} +else + {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and campaign_id='$group';";} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if (eregi("CLOSER",$group)) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; +$Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; +$Aecho .= "| STATION | USER | SESSIONID | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; +$Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='$group' order by status,last_call_time;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[5]=$row[6]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $sessionid = sprintf("%-9s", $row[2]); + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $call_time_S = ($STARTtime - $row[5]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} +# if ($call_time_M_int >= 10) {$G=''; $EG='';} + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 1) + {$i++; continue;} + else + {$G=''; $EG=''; $agent_paused++; $agent_total++;} + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$G=''; $EG='';} + + $agentcount++; + $Aecho .= "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$status$EG | $G$server_ip$EG | $G$call_server_ip$EG | $G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= " $agentcount agents logged in on all servers\n\n"; + + $Aecho .= " - Paused agents\n"; + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Over 5 minutes on call\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + diff --git a/VICIDIAL_web/AST_timeoncall.php b/VICIDIAL_web/AST_timeoncall.php new file mode 100644 index 0000000..093f594 --- /dev/null +++ b/VICIDIAL_web/AST_timeoncall.php @@ -0,0 +1,176 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 60);
+			$call_time_M = round($call_time_M, 2);
+			$call_time_M_int = intval("$call_time_M");
+			$call_time_SEC = ($call_time_M - $call_time_M_int);
+			$call_time_SEC = ($call_time_SEC * 60);
+			$call_time_SEC = round($call_time_SEC, 0);
+			if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+			$call_time_MS = "$call_time_M_int:$call_time_SEC";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/AST_timeonpark.php b/VICIDIAL_web/AST_timeonpark.php new file mode 100644 index 0000000..75ecd44 --- /dev/null +++ b/VICIDIAL_web/AST_timeonpark.php @@ -0,0 +1,193 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park                       $NOW_TIME\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='$server_ip' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "******************** NO LIVE CALLS WAITING *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='$server_ip' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 60);
+		$call_time_M = round($call_time_M, 2);
+		$call_time_M_int = intval("$call_time_M");
+		$call_time_SEC = ($call_time_M - $call_time_M_int);
+		$call_time_SEC = ($call_time_SEC * 60);
+		$call_time_SEC = round($call_time_SEC, 0);
+		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
+		$call_time_MS = "$call_time_M_int:$call_time_SEC";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/VICIDIAL_web/admin.php b/VICIDIAL_web/admin.php new file mode 100644 index 0000000..9afeb39 --- /dev/null +++ b/VICIDIAL_web/admin.php @@ -0,0 +1,4156 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$full_name=$_GET["full_name"]; if (!$full_name) {$full_name=$_POST["full_name"];} +$user_level=$_GET["user_level"]; if (!$user_level) {$user_level=$_POST["user_level"];} +$user_group=$_GET["user_group"]; if (!$user_group) {$user_group=$_POST["user_group"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$campaign_name=$_GET["campaign_name"]; if (!$campaign_name) {$campaign_name=$_POST["campaign_name"];} +$active=$_GET["active"]; if (!$active) {$active=$_POST["active"];} +$park_ext=$_GET["park_ext"]; if (!$park_ext) {$park_ext=$_POST["park_ext"];} +$park_file_name=$_GET["park_file_name"]; if (!$park_file_name) {$park_file_name=$_POST["park_file_name"];} +$web_form_address=$_GET["web_form_address"]; if (!$web_form_address) {$web_form_address=$_POST["web_form_address"];} +$allow_closers=$_GET["allow_closers"]; if (!$allow_closers) {$allow_closers=$_POST["allow_closers"];} +$hopper_level=$_GET["hopper_level"]; if (!$hopper_level) {$hopper_level=$_POST["hopper_level"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$next_agent_call=$_GET["next_agent_call"]; if (!$next_agent_call) {$next_agent_call=$_POST["next_agent_call"];} +$local_call_time=$_GET["local_call_time"]; if (!$local_call_time) {$local_call_time=$_POST["local_call_time"];} +$voicemail_ext=$_GET["voicemail_ext"]; if (!$voicemail_ext) {$voicemail_ext=$_POST["voicemail_ext"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$list_name=$_GET["list_name"]; if (!$list_name) {$list_name=$_POST["list_name"];} +$group_id=$_GET["group_id"]; if (!$group_id) {$group_id=$_POST["group_id"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$group_color=$_GET["group_color"]; if (!$group_color) {$group_color=$_POST["group_color"];} +$fronter_display=$_GET["fronter_display"]; if (!$fronter_display) {$fronter_display=$_POST["fronter_display"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$group_name=$_GET["group_name"]; if (!$group_name) {$group_name=$_POST["group_name"];} +$dial_status_a=$_GET["dial_status_a"]; if (!$dial_status_a) {$dial_status_a=$_POST["dial_status_a"];} +$dial_status_b=$_GET["dial_status_b"]; if (!$dial_status_b) {$dial_status_b=$_POST["dial_status_b"];} +$dial_status_c=$_GET["dial_status_c"]; if (!$dial_status_c) {$dial_status_c=$_POST["dial_status_c"];} +$dial_status_d=$_GET["dial_status_d"]; if (!$dial_status_d) {$dial_status_d=$_POST["dial_status_d"];} +$dial_status_e=$_GET["dial_status_e"]; if (!$dial_status_e) {$dial_status_e=$_POST["dial_status_e"];} +$lead_order=$_GET["lead_order"]; if (!$lead_order) {$lead_order=$_POST["lead_order"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$campaign_vdad_exten=$_GET["campaign_vdad_exten"]; if (!$campaign_vdad_exten) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +$campaign_rec_exten=$_GET["campaign_rec_exten"]; if (!$campaign_rec_exten) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +$campaign_recording=$_GET["campaign_recording"]; if (!$campaign_recording) {$campaign_recording=$_POST["campaign_recording"];} +$campaign_rec_filename=$_GET["campaign_rec_filename"]; if (!$campaign_rec_filename) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +$hotkey=$_GET["hotkey"]; if (!$hotkey) {$hotkey=$_POST["hotkey"];} +$reset_list=$_GET["reset_list"]; if (!$reset_list) {$reset_list=$_POST["reset_list"];} +$old_campaign_id=$_GET["old_campaign_id"]; if (!$old_campaign_id) {$old_campaign_id=$_POST["old_campaign_id"];} +$OLDuser_group=$_GET["OLDuser_group"]; if (!$OLDuser_group) {$OLDuser_group=$_POST["OLDuser_group"];} +$status_name=$_GET["status_name"]; if (!$status_name) {$status_name=$_POST["status_name"];} +$selectable=$_GET["selectable"]; if (!$selectable) {$selectable=$_POST["selectable"];} +$HKstatus=$_GET["HKstatus"]; if (!$HKstatus) {$HKstatus=$_POST["HKstatus"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} +$delete_users=$_GET["delete_users"]; if (!$delete_users) {$delete_users=$_POST["delete_users"];} +$delete_user_groups=$_GET["delete_user_groups"]; if (!$delete_user_groups) {$delete_user_groups=$_POST["delete_user_groups"];} +$delete_lists=$_GET["delete_lists"]; if (!$delete_lists) {$delete_lists=$_POST["delete_lists"];} +$delete_campaigns=$_GET["delete_campaigns"]; if (!$delete_campaigns) {$delete_campaigns=$_POST["delete_campaigns"];} +$delete_ingroups=$_GET["delete_ingroups"]; if (!$delete_ingroups) {$delete_ingroups=$_POST["delete_ingroups"];} +$delete_remote_agents=$_GET["delete_remote_agents"]; if (!$delete_remote_agents) {$delete_remote_agents=$_POST["delete_remote_agents"];} +$load_leads=$_GET["load_leads"]; if (!$load_leads) {$load_leads=$_POST["load_leads"];} +$campaign_detail=$_GET["campaign_detail"]; if (!$campaign_detail) {$campaign_detail=$_POST["campaign_detail"];} +$ast_admin_access=$_GET["ast_admin_access"]; if (!$ast_admin_access) {$ast_admin_access=$_POST["ast_admin_access"];} +$ast_delete_phones=$_GET["ast_delete_phones"]; if (!$ast_delete_phones) {$ast_delete_phones=$_POST["ast_delete_phones"];} +$CoNfIrM=$_GET["CoNfIrM"]; if (!$CoNfIrM) {$CoNfIrM=$_POST["CoNfIrM"];} +$delete_scripts=$_GET["delete_scripts"]; if (!$delete_scripts) {$delete_scripts=$_POST["delete_scripts"];} +$script_id=$_GET["script_id"]; if (!$script_id) {$script_id=$_POST["script_id"];} + $script_id = strtoupper($script_id); +$script_name=$_GET["script_name"]; if (!$script_name) {$script_name=$_POST["script_name"];} +$script_comments=$_GET["script_comments"]; if (!$script_comments) {$script_comments=$_POST["script_comments"];} +$script_text=$_GET["script_text"]; if (!$script_text) {$script_text=$_POST["script_text"];} +$reset_hopper=$_GET["reset_hopper"]; if (!$reset_hopper) {$reset_hopper=$_POST["reset_hopper"];} +$get_call_launch=$_GET["get_call_launch"]; if (!$get_call_launch) {$get_call_launch=$_POST["get_call_launch"];} +$am_message_exten=$_GET["am_message_exten"]; if (!$am_message_exten) {$am_message_exten=$_POST["am_message_exten"];} +$amd_send_to_vmx=$_GET["amd_send_to_vmx"]; if (!$amd_send_to_vmx) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"]; if (!$xferconf_a_dtmf) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +$xferconf_a_number=$_GET["xferconf_a_number"]; if (!$xferconf_a_number) {$xferconf_a_number=$_POST["xferconf_a_number"];} +$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"]; if (!$xferconf_b_dtmf) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +$xferconf_b_number=$_GET["xferconf_b_number"]; if (!$xferconf_b_number) {$xferconf_b_number=$_POST["xferconf_b_number"];} +$modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST["modify_leads"];} +$hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} +$change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} +$agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} + + + + +### AST GUI database administration +### admin.php +### +### CHANGES +### 50315-1110 - Added Custom Campaign Statuses +### 50317-1438 - Added Fronter Display var to inbound groups +### 50322-1355 - Added custom callerID per campaign +### 50517-1356 - Added user_groups sections and user_group to vicidial_users +### 50517-1440 - Added ability to logout (must click OK with empty user/pass) +### 50602-1622 - Added lead loader pages to load new files into vicidial_list +### 50620-1351 - Added custom vdad transfer AGI extension per campaign +### 50810-1414 - modified in groups to kick out spaces and dashes +### 50908-2136 - Added Custom Campaign HotKeys +### 50914-0950 - Fixed user search by user_group +### 50926-1358 - Modified to allow for language translation +### 50926-1615 - Added WeBRooTWritablE write controls +### 51020-1008 - Added editable web address and park ext - NEW dial campaigns +### 51020-1056 - Added fields and help for campaign recording control +### 51123-1335 - Altered code to function in php globals=off +### 51208-1038 - Added user_level changes, function controls and default user phones +### 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +### 51213-1706 - Added add/delete/modify vicidial scripts +### 51214-1737 - Added preview of vicidial script in popup window +### 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +### 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +### 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +### 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +### 60204-0659 - Fixed hopper reset bug +### 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +### 60213-1100 - Added several vicidial_users permissions fields +### 60215-1319 - Added On-hold CallBacks display and links +### 60227-1226 - Fixed vicidial_inbound_groups insert bug + +### 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 + +$version = '1.1.10-5'; +$build = '60227-1226'; + +$STARTtime = date("U"); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGdelete_scripts =$row[18]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if ($ADD==1) {echo "Add New User";} +if ($ADD==11) {echo "Add New Campaign";} +if ($ADD==111) {echo "Add New List";} +if ($ADD==1111) {echo "Add New In-Group";} +if ($ADD==11111) {echo "Add New Remote Agents";} +if ($ADD==111111) {echo "Add New Users Group";} +if ($ADD==1111111) {echo "Add New Script";} +if ($ADD==2) {echo "New User Addition";} +if ($ADD==21) {echo "New Campaign Addition";} +if ($ADD==22) {echo "New Campaign Status Addition";} +if ($ADD==23) {echo "New Campaign HotKey Addition";} +if ($ADD==211) {echo "New List Addition";} +if ($ADD==2111) {echo "New In-Group Addition";} +if ($ADD==21111) {echo "New Remote Agents Addition";} +if ($ADD==211111) {echo "New Users Group Addition";} +if ($ADD==2111111) {echo "New Script Addition";} +if ($ADD==3) {echo "Modify User";} +if ($ADD==31) {echo "Modify Campaign";} +if ($ADD==34) {echo "Modify Campaign - Basic View";} +if ($ADD==311) {echo "Modify List";} +if ($ADD==3111) {echo "Modify In-Group";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==311111) {echo "Modify Users Groups";} +if ($ADD==3111111) {echo "Modify Script";} +if ($ADD=="4A") {echo "Modify User - Admin";} +if ($ADD==4) {echo "Modify User";} +if ($ADD==41) {echo "Modify Campaign";} +if ($ADD==42) {echo "Modify Campaign Status";} +if ($ADD==43) {echo "Modify Campaign HotKey";} +if ($ADD==44) {echo "Modify Campaign - Basic View";} +if ($ADD==411) {echo "Modify List";} +if ($ADD==4111) {echo "Modify In-Group";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==411111) {echo "Modify Users Groups";} +if ($ADD==4111111) {echo "Modify Script";} +if ($ADD==5) {echo "Delete User";} +if ($ADD==51) {echo "Delete Campaign";} +if ($ADD==52) {echo "Logout Agents";} +if ($ADD==511) {echo "Delete List";} +if ($ADD==5111) {echo "Delete In-Group";} +if ($ADD==51111) {echo "Delete Remote Agents";} +if ($ADD==511111) {echo "Delete Users Group";} +if ($ADD==5111111) {echo "Delete Script";} +if ($ADD==6) {echo "Delete User";} +if ($ADD==61) {echo "Delete Campaign";} +if ($ADD==62) {echo "Logout Agents";} +if ($ADD==611) {echo "Delete List";} +if ($ADD==6111) {echo "Delete In-Group";} +if ($ADD==61111) {echo "Delete Remote Agents";} +if ($ADD==611111) {echo "Delete Users Group";} +if ($ADD==6111111) {echo "Delete Script";} +if ($ADD==7111111) {echo "Preview Script";} +if ($ADD==0) {echo "Welcome";} +if ($ADD==8) {echo "CallBacks Within Agent";} +if ($ADD==81) {echo "CallBacks Within Campaign";} +if ($ADD==811) {echo "CallBacks Within List";} +if ($ADD==10) {echo "Campaigns";} +if ($ADD==100) {echo "Lists";} +if ($ADD==1000) {echo "In-Groups";} +if ($ADD==10000) {echo "Remote Agents";} +if ($ADD==100000) {echo "User Groups";} +if ($ADD==1000000) {echo "Scripts";} +if ($ADD==55) {echo "Search Form";} +if ($ADD==66) {echo "Search Results";} +if ($ADD==99999) {echo "HELP";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rsltx=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rsltx); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or ($ADD=="4A") ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\""; + $p=0; + while ($p<100) + { + if ($group_id_value == $groups[$p]) + { + $groups_list .= " CHECKED"; + $groups_value .= " $group_id_value"; + } + $p++; + } + $groups_list .= "> $group_id_value - $group_name_value<BR>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + } + + + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, 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. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+HotKeys Active - This option if set to 1 allows the user to use the HotKeys quick-dispositioning function in vicidial.php. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_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. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL 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. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Dial Timeout - If defined, calls that would normally hangup after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dialplan - extensions.conf. + +
+
+
+Campaign CallerID - 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. This option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on. This feature may also work with IAX2 trunks depending on what your provider allows. The custom callerID only applies to calls placed for the VICIDIAL 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. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. 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 upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. 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. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dialplan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL 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 VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Voicemail - If defined, this is the Voicemail box that calls will go to instead of being dropped if no agents are available after the hold time is up. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. + +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. + + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - 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 VICIDIAL 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. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dialplan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+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 VICIDIAL as a disposition. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hotkeys, agents that use the vicidial web-client can hangup and disposition calls just by pressing a single key on their keyboard. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial 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. + +
+
+Script Name - This is the title of a Vicidial 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. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today? + +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL 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 vicidial_list table. There is also a new beta version super lead loader that 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 or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /home/cron/AST_SERVER_conf.pl file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. + +







+







+THE END +
+\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + + +?> + + + + +\n"; +?> +
+ + + + + + + +
  VICIDIAL ADMIN - Logout  
  LIST USERS | ADD A NEW USER | SEARCH FOR A USER |               |ADD USER GROUP | LIST USER GROUPS
  ADD CAMPAIGN | LIST CAMPAIGNS |              | SHOW LISTS | ADD NEW LIST |               | LOAD NEW LEADS
  SHOW IN-GROUPS | ADD NEW IN-GROUP |               | SHOW REMOTE AGENTS | ADD NEW REMOTE AGENTS
  STATS AND REPORTS               | ADD SCRIPT | VIEW SCRIPTS |             | SEARCH FOR A LEAD | GROUP HOURLY
+"; + +echo "
ADD A NEW USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "$NWB#vicidial_users-user_group$NWE\n"; +echo "\n"; +echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ +echo ""; + +echo "
ADD A NEW CAMPAIGN\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ +echo ""; + +echo "
ADD A NEW LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ +echo ""; + +echo "
ADD A NEW INBOUND GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ +echo ""; + +echo "
ADD NEW REMOTE AGENTS\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ +echo ""; + +echo "
ADD NEW USERS GROUP\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ +echo ""; + +echo "
ADD NEW SCRIPT\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: $NWB#vicidial_scripts-script_text$NWE
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD==2) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\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');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } +$ADD=3; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|INSERT INTO vicidial_campaigns (campaign_id,campaign_name,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch) values('$campaign_id','$campaign_name','$active','NEW','DOWN','$park_ext','$park_file_name','$web_form_address','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch')|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } + } +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOTKEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOTKEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOTKEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or (strlen($list_id) < 2) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists values('$list_id','$list_name','$campaign_id','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|'$list_id','$list_name','$campaign_id','$active'|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|'$group_id','$group_name','$group_color','$active','$web_form_address','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch'|\n"); + fclose($fp); + } + } + } +$ADD=1000; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups values('$user_group','$group_name');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|'$user_group','$group_name'|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|'$script_id','$script_name','$script_comments','$script_text','$active'|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|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' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\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' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user'|\n"); + fclose($fp); + } + } + +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level', next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='$web_form_address', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 delete campaign status in the system +###################### + +if ($ADD==42) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOTKEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOTKEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + $stmt="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status='READY';"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name'|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', auto_dial_level='$auto_dial_level' where campaign_id='$campaign_id'|$reset_hopper|\n"); + fclose($fp); + } + } + +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active' where list_id='$list_id'|\n"); + fclose($fp); + } + } + +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|group_name='$group_name',group_color='$group_color',active='$active', web_form_address='$web_form_address', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number' where group_id='$group_id'|\n"); + fclose($fp); + } + } + +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name' where user_group='$OLDuser_group'|\n"); + fclose($fp); + } + } + +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id'|\n"); + fclose($fp); + } + } + +$ADD=3111111; # go to script modification form below +} + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to user group modification below +} + + + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|user='$user'|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents fro a campaign +###################### + +if ($ADD==62) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='31'; # go to campaign modification below +} +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to user group list +} + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + +if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } +else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + {echo "\n";} + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level > 8) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
HotKeys Active: $NWB#vicidial_users-hotkeys_active$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_users-closer_campaigns$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ($ADD==31) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + +echo "
MODIFY A CAMPAIGNS RECORD: $row[0] - Basic View | Detail View\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + + + + + + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + + + + +echo "
\n"; +echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
STATUSDESCRIPTIONSELECTABLEDELETE
$rowx[0]$rowx[1]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; +echo "\n"; +echo "\n"; +echo "Status:   \n"; +echo "Description:   \n"; +echo "Selectable:   \n"; +echo "
\n"; + +echo "

\n"; + + + +echo "
CUSTOM HOTKEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
HOTKEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + +echo "
ADD NEW CUSTOM CAMPAIGN HOTKEY
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Hotkey:   \n"; +echo "Status:   \n"; +echo "
\n"; + +echo "

\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ($ADD==34) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + +echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Basic View | Detail View
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; +echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + ##### calculate what gmt_offset_now values are within the allowed local_call_time setting + if ($local_call_time == '24hours') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',"; + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '9am-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 9) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-5pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 16) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '12pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 12) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + if ($local_call_time == '5pm-9pm') + { + $p='13'; + $GMT_allowed = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $phour=gmdate("G", time() + $pzone); + if ( ($phour >= 17) && ($phour <= 20) ){$tz = sprintf("%.2f", $p); $GMT_allowed = "$GMT_allowed'$tz',";} + $p = ($p - 0.25); + } + } + + $GMT_allowed = "$GMT_allowed'99'"; + + + +echo "
\n"; +echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; +echo "\n"; +echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + +echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; +echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); +echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed)"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rsltx_rows = mysql_num_rows($rsltx); + if ($rsltx_rows) + { + $rowx=mysql_fetch_row($rsltx); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + +echo "This campaign has $active_leads leads to be dialed in those lists

\n"; + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $hopper_leads = "$rowx[0]"; + +echo "This campaign has $hopper_leads leads in the dial hopper

\n"; +echo "Click here to see what leads are in the hopper right now

\n"; +echo "Click here to see all CallBack Holds in this campaign

\n"; +echo "
\n"; + +echo "
\n"; + +echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + +if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + + +} + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + +echo "
MODIFY A LISTS RECORD: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
\n"; + +echo "
\n"; +echo "
STATUSES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[0] == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
STATUSCALLEDNOT CALLED
$CLB$rowx[0]$CLE $rowx[2]
$CLB$rowx[0]$CLE$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + +echo "
\n"; +echo "
TIME ZONES WITHIN THIS LIST:
\n"; +echo "\n"; +echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rsltx=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rsltx); + + $o=0; + $plus='+'; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + + $LOCALzone=3600 * $rowx[0]; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($rowx[0] >= 0) {$rowx[0] = "$plus$rowx[0]";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($rowx[1] == 'N') + { + $leads_in_list_N = ($leads_in_list_N + $rowx[2]); + echo "\n"; + } + else + { + $leads_in_list_Y = ($leads_in_list_Y + $rowx[2]); + echo "\n"; + + } + + $o++; + } + +echo "\n"; +echo "\n"; + +echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
$rowx[0]     ($LOCALdate) $rowx[2]
$rowx[0]     ($LOCALdate)$rowx[2]
SUBTOTALS$leads_in_list_Y$leads_in_list_N
TOTAL$leads_in_list

\n"; + + + + + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rsltx=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rsltx); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + +echo "
\n"; +echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; +echo "\n"; +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} +# echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; +# echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$status[$sts]") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + +echo ""; +$first = $all_called_first; +while ($first <= $all_called_last) + { + echo ""; + $first++; + } +echo "\n"; + +echo "
STATUS$firstSUBTOTAL
$status[$sts] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + +echo "
\n"; + +if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + +echo "
MODIFY A GROUPS RECORD: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + +echo "\n"; + + +echo "\n"; +echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
\n"; + +echo "

\n"; + +echo "
\n"; + +if ($LOGdelete_ingroups > 0) + { + echo "

DELETE THIS IN-GROUP\n"; + } + +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dialplan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; +echo "$groups_list"; +echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + +if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; +echo ""; + +echo "
MODIFY A USERS GROUP ENTRY\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + +if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; +echo ""; + +echo "
MODIFY A SCRIPT\n"; +echo "\n"; +echo "\n"; +echo "Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE\n"; +echo "Script Comments: $NWB#vicidial_scripts-script_comments$NWE\n"; +echo "Active: $NWB#vicidial_scripts-active$NWE\n"; +echo "Script Text:

Preview Script $NWB#vicidial_scripts-script_text$NWE\n"; +echo "\n"; +echo "
\n"; + +if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + +} + + + + + + +###################### +# ADD=55 search form +###################### + +if ($ADD==55) +{ +echo ""; + +echo "
SEARCH FOR A USER\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=66 user search results +###################### + +if ($ADD==66) +{ + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and user='$user' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and campaign_id='$campaign_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + echo ""; + + $stmt="SELECT * from vicidial_callbacks where status='ACTIVE' and list_id='$list_id' order by callback_time desc"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ +echo "
\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTCAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENT
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]
\n"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ + echo ""; + + $stmt="SELECT * from vicidial_users order by full_name"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + + diff --git a/VICIDIAL_web/admin_modify_lead.php b/VICIDIAL_web/admin_modify_lead.php new file mode 100644 index 0000000..9440ee5 --- /dev/null +++ b/VICIDIAL_web/admin_modify_lead.php @@ -0,0 +1,321 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead record modification + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where lead_id='$lead_id' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
\n"; + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/admin_search_lead.php b/VICIDIAL_web/admin_search_lead.php new file mode 100644 index 0000000..e5d4af3 --- /dev/null +++ b/VICIDIAL_web/admin_search_lead.php @@ -0,0 +1,185 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +### AST GUI database administration search for lead info +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + + +
\n"; + echo "
\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='$vendor_id'"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='$phone'"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if (eregi('10.10.10.2',$ip)) + { + echo "\n\n$stmt\n\n"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($row[0]) < 3) && (strlen($row[1]) < 3) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "\n
\n\n";
+		echo "lead ID: $row[0]\n";
+		echo "status: $row[3]\n";
+		echo "vendor_id: $row[5]\n";
+		echo "last rep called: $row[4]\n";
+		echo "list_id: $row[7]\n";
+		echo "phone: $row[11]\n";
+		echo "Name: $row[13] $row[15]\n";
+		echo "City: $row[19]\n";
+		echo "Security: $row[28]\n";
+		echo "Comments: $row[29]\n\n";
+		echo "\n";
+		echo "
\n"; + + # https://www.vicimarketing.com/internal/back_end_sys/uk_cust_serv/index.php?person_id=$row[7]&people_packages_id=&secure_lvl=2&display=2&username=$username&passwd=$passwd + + echo "Click here to see the Lead Details\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/VICIDIAL_web/closer-fronter_popup.php b/VICIDIAL_web/closer-fronter_popup.php new file mode 100644 index 0000000..7645452 --- /dev/null +++ b/VICIDIAL_web/closer-fronter_popup.php @@ -0,0 +1,468 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$customer_zap_channel=$_GET["customer_zap_channel"]; if (!$customer_zap_channel) {$customer_zap_channel=$_POST["customer_zap_channel"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_id=$_GET["session_id"]; if (!$session_id) {$session_id=$_POST["session_id"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) + { + echo "\n\n"; + echo "\n\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; + $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $filename','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('Zap/$channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$user'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $user - $full_name\n

\n"; + + $url = "http://10.10.99.2/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + +# $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$user' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; +# if ($DB) {echo "|$stmt|\n";} +# $fp = fopen ("./closer_SQL_updates.txt", "a"); +# fwrite ($fp, "$date|$user|$stmt|\n"); +# fclose($fp); +# $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/closer-fronter_popup2.php b/VICIDIAL_web/closer-fronter_popup2.php new file mode 100644 index 0000000..a2ae34a --- /dev/null +++ b/VICIDIAL_web/closer-fronter_popup2.php @@ -0,0 +1,383 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$customer_zap_channel=$_GET["customer_zap_channel"]; if (!$customer_zap_channel) {$customer_zap_channel=$_POST["customer_zap_channel"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_id=$_GET["session_id"]; if (!$session_id) {$session_id=$_POST["session_id"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if (!$auth) + { + if ( (strlen($PHP_AUTH_USER)>1) and ( (eregi("tsr",$PHP_AUTH_PW)) or (eregi("sales",$PHP_AUTH_PW)) ) ) + { + $auth=1; + $user = $PHP_AUTH_USER; + $pass = $PHP_AUTH_PW; + } + } + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER - $user - $PHP_AUTH_USER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and ( (eregi('zap',$customer_zap_channel)) or (eregi('iax',$customer_zap_channel)) ) ) + { + echo "\n\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; +# $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $filename','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$fronter'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $fronter - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='$channel_group'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $group_name = $row[0]; + $group_color = $row[1]; + + echo "
\n"; + echo "
$channel_group - $group_name

\n\n"; + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### + +if (eregi('CL',$channel_group)) + { + if (strlen($phone) > 9) {$search_phone = $phone;} + if ( (strlen($search_phone) < 10) or (strlen($fronter) < 1) ) + { + echo "\n"; + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($fronter) < 1) {$fronter=$row[0];} + if (strlen($search_phone) < 10) {$search_phone=$row[1];} + } + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/closer.php b/VICIDIAL_web/closer.php new file mode 100644 index 0000000..0d1983a --- /dev/null +++ b/VICIDIAL_web/closer.php @@ -0,0 +1,329 @@ + LICENSE: GPLv2 +### +# the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$group_selected=$_GET["group_selected"]; if (!$group_selected) {$group_selected=$_POST["group_selected"];} +$dialplan_number=$_GET["dialplan_number"]; if (!$dialplan_number) {$dialplan_number=$_POST["dialplan_number"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$groupselect=$_GET["groupselect"]; if (!$groupselect) {$groupselect=$_POST["groupselect"];} +$PHONE_LOGIN=$_GET["PHONE_LOGIN"]; if (!$PHONE_LOGIN) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} +$debugvars=$_GET["debugvars"]; if (!$debugvars) {$debugvars=$_POST["debugvars"];} +$parked_by=$_GET["parked_by"]; if (!$parked_by) {$parked_by=$_POST["parked_by"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$popup_page = './closer_popup.php'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$color_class[0] = 'green'; +$color_class[1] = 'red'; +$color_class[2] = 'blue'; +$color_class[3] = 'purple'; +$color_class[4] = 'orange'; +$color_class[5] = 'green'; +$color_class[6] = 'red'; +$color_class[7] = 'blue'; +$color_class[8] = 'purple'; +$color_class[9] = 'orange'; +?> + + + + + +VICIDIAL CLOSER: Main + + +
+ + 0) + { + $stmt="SELECT dialplan_number,server_ip from phones where extension='$extension';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dialplan_number=$row[0]; + $server_ip=$row[1]; + + if (!$group_selected) + { + $stmt="select distinct channel_group from park_log;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $groups_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + echo "
Please select the groups you want to pick calls up from:
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inbound Call Groups:
\n"; + $o=0; + while ($groups_to_print > $o) + { + $group_form_print = sprintf("%-20s", $groups[$o]); + echo "$group_form_print
\n"; + $o++; + } + echo "
\n"; + echo "\n"; + echo "


\n"; + } + else + { + $o=0; + while($o < $group_selected) + { + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; + } + + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGIN','CLOSER','$NOW_TIME','$STARTtime');"; + $rslt=mysql_query($stmt, $link); + + echo"\n"; + echo"\n"; + + echo "extension found, forwarding you to closer page, please wait 3 seconds...
\n"; + } + + } + else + { + echo "The extension you entered does not exist, please try again
\n"; + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + + } + else + { + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + +exit; + +} + +$o=0; +while($o < $group_selected) +{ + $listen_groups = "$listen_groups     $groupselect[$o]"; + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; +} + + +echo"\n"; +echo"\n"; + +#CHANNEL SERVER CHANNEL_GROUP EXTENSION PARKED_BY PARKED_TIME +#---------------------------------------------------------------------------------------------- +#Zap/73-1 10.10.11.11 IN_800_TPP_CS TPPpark 7275338730 2004-04-22 12:41:00 + + + +echo "$NOW_TIME           $PHP_AUTH_USER - $fullname - CALLS SENT TO: $dialplan_number

\n"; + +echo "Click on the channel below that you would like to have directed to your phone
\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME         \n";
+echo "---------------------------------------------------------------------------------------------- \n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='$server_ip'";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='$server_ip' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$park_extension =	sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		$G='';   $EG='';
+		$o=0;
+		$with_color=0;
+		while($o < $group_selected)
+			{
+				if (eregi("$groupselect[$o]",$channel_group))
+					{
+					$G=""; $EG='';
+					$with_color++;
+					}
+				$o++;
+			}
+		if ($with_color)
+			{
+			if (eregi('CL_GAL',$row[2]))
+				{
+				echo "$G$channel$server$channel_group$park_extension                     $parked_time $EG\n";
+				}
+			else
+				{
+				echo "$G$channel$server$channel_group$park_extension$parked_by$parked_time $EG\n";
+				}
+			}
+#	
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "*************************************** NO PARKED CALLS ************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	}
+
+echo "  \n\n";
+echo "looking for calls on these groups:\n";
+$o=0;
+while($o < $group_selected)
+{
+	$group_print =		sprintf("%-20s", $groupselect[$o]);
+	echo "             - $group_print\n";
+	$o++;
+}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/closer_dispo.php b/VICIDIAL_web/closer_dispo.php new file mode 100644 index 0000000..2b15070 --- /dev/null +++ b/VICIDIAL_web/closer_dispo.php @@ -0,0 +1,284 @@ + LICENSE: GPLv2 +### +# this is the closer disposition screen of a call that has been grabbed. This allows the closer to modify customer information and disposition the call + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL CLOSER: Call Disposition + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('$lead_id','$list_id','$campaign_id','$parked_time','$call_began','$STARTtime','$call_length','$status','$phone_code','$phone_number','$PHP_AUTH_USER','$comments','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from live_channels where server_ip='$server_ip' and channel='$channel' and extension like \"%$extension%\""; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $parked_count = $row[0]; + + if ($parked_count > 0) + { + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$DTqueryCID','Channel: $channel','','','','','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Hangup command sent for channel $channel       $NOW_TIME\n

\n"; + + echo "\n"; + } + else + { + echo "Hangup command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; + } +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/closer_popup.php b/VICIDIAL_web/closer_popup.php new file mode 100644 index 0000000..2b59b3a --- /dev/null +++ b/VICIDIAL_web/closer_popup.php @@ -0,0 +1,429 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that grabs the call and allows you to go and fetch info on that caller in the local CRM system. + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$group_selected=$_GET["group_selected"]; if (!$group_selected) {$group_selected=$_POST["group_selected"];} +$dialplan_number=$_GET["dialplan_number"]; if (!$dialplan_number) {$dialplan_number=$_POST["dialplan_number"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$groupselect=$_GET["groupselect"]; if (!$groupselect) {$groupselect=$_POST["groupselect"];} +$PHONE_LOGIN=$_GET["PHONE_LOGIN"]; if (!$PHONE_LOGIN) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} +$debugvars=$_GET["debugvars"]; if (!$debugvars) {$debugvars=$_POST["debugvars"];} +$parked_by=$_GET["parked_by"]; if (!$parked_by) {$parked_by=$_POST["parked_by"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +#$DB=1; +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL CLOSER: Popup\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + + #$monitor_channel = eregi_replace('Zap/', "", $channel); + $monitor_channel = eregi_replace('-1', "", $channel); + $SIPexten = $extension; + $filename = "$REC_TIME$US$SIPexten"; + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: $monitor_channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$monitor_channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; +# $rslt=mysql_query($stmt, $link); +# if ($DB) {echo "$stmt\n";} +# $row=mysql_fetch_row($rslt); +# $recording_id = $row[0]; + +# echo "Recording command sent for channel $channel - $filename - $recording_id
\n"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='$parked_by'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $parked_by - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$parked_by&channel=$channel&server_ip=$server_ip&extension=$extension&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + + $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$PHP_AUTH_USER' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; + if ($DB) {echo "|$stmt|\n";} + $fp = fopen ("./closer_SQL_updates.txt", "a"); + fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); + fclose($fp); + + + $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/count.htm b/VICIDIAL_web/count.htm new file mode 100644 index 0000000..51f8a36 --- /dev/null +++ b/VICIDIAL_web/count.htm @@ -0,0 +1 @@ + diff --git a/VICIDIAL_web/dbconnect.php b/VICIDIAL_web/dbconnect.php new file mode 100644 index 0000000..63ad820 --- /dev/null +++ b/VICIDIAL_web/dbconnect.php @@ -0,0 +1,20 @@ + LICENSE: GPLv2 +### + +$link=mysql_connect("localhost", "cron", "1234"); +mysql_select_db("asterisk"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; + +#$WeBServeRRooT = '/home/www/htdocs'; +$WeBServeRRooT = '/usr/local/apache2/htdocs'; +$WeBRooTWritablE = '1'; + +?> \ No newline at end of file diff --git a/VICIDIAL_web/group_hourly_stats.php b/VICIDIAL_web/group_hourly_stats.php new file mode 100644 index 0000000..ac9ec58 --- /dev/null +++ b/VICIDIAL_web/group_hourly_stats.php @@ -0,0 +1,222 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$date_with_hour=$_GET["date_with_hour"]; if (!$date_with_hour) {$date_with_hour=$_POST["date_with_hour"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!$date_with_hour) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats + + +
+ + + + + += '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_no_hour 00:00:00' and call_date <= '$date_no_hour 23:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '$date_with_hour:00:00' and call_date <= '$date_with_hour:59:59' and user='$VDuser[$o]' and status='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
  VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/VICIDIAL_web/help.gif b/VICIDIAL_web/help.gif new file mode 100644 index 0000000..5575d7c Binary files /dev/null and b/VICIDIAL_web/help.gif differ diff --git a/VICIDIAL_web/listloader.php b/VICIDIAL_web/listloader.php new file mode 100644 index 0000000..a87f9a4 --- /dev/null +++ b/VICIDIAL_web/listloader.php @@ -0,0 +1,187 @@ + LICENSE: GPLv2 +### +### AST Web GUI lead loader from formatted file +### +### CHANGES +### 50602-1640 - First version created by Joe Johnson +### 51128-1108 - Removed PHP global vars requirement +### +### make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +$version = '1.1'; +$build = '51128-1108'; + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + +
Load leads from this file:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("./vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + \ No newline at end of file diff --git a/VICIDIAL_web/listloader.pl b/VICIDIAL_web/listloader.pl new file mode 100644 index 0000000..818ba12 --- /dev/null +++ b/VICIDIAL_web/listloader.pl @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +### listloader.pl +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### + +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$|=0; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate="$year-$mon-$mday $hour:$min:$sec"; + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $campaign_id = ''; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + diff --git a/VICIDIAL_web/listloaderMAIN.php b/VICIDIAL_web/listloaderMAIN.php new file mode 100644 index 0000000..fc5e3bd --- /dev/null +++ b/VICIDIAL_web/listloaderMAIN.php @@ -0,0 +1,72 @@ + LICENSE: GPLv2 +### +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/VICIDIAL_web/listloader_rowdisplay.pl b/VICIDIAL_web/listloader_rowdisplay.pl new file mode 100644 index 0000000..fc2b4fc --- /dev/null +++ b/VICIDIAL_web/listloader_rowdisplay.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### + +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$dbhA->query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1"); + +if ($dbhA->has_selected_record) { + $rslt = $dbhA->create_record_iterator(); + my @row = $rslt->get_field_names(); + for ($i=0; $i\r\n"; + print " ".$field_name.": \r\n"; + print " \r\n"; + print " \r\n"; + } +} + diff --git a/VICIDIAL_web/listloader_super.pl b/VICIDIAL_web/listloader_super.pl new file mode 100644 index 0000000..e26c9a7 --- /dev/null +++ b/VICIDIAL_web/listloader_super.pl @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +### listloader_super.pl +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### + +use Spreadsheet::ParseExcel; +use Time::Local; +use Net::MySQL; + +### Make sure this file is in a libs path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +$dbhA = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port") + or die "Couldn't connect to database: $DB_server - $DB_database\n"; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate="$year-$mon-$mday $hour:$min:$sec"; + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("./vicidial_temp_file.xls"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $campaign_id = ''; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $dbhA->query("$stmtZ"); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + diff --git a/VICIDIAL_web/log_test.php b/VICIDIAL_web/log_test.php new file mode 100644 index 0000000..2c03a9a --- /dev/null +++ b/VICIDIAL_web/log_test.php @@ -0,0 +1,37 @@ + LICENSE: GPLv2 +### + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + +$fp = fopen ("./closer_SQL_updates.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + fwrite ($fp, "CLOSER SQL UPDATE|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + + +exit; + + + +?> + + +Hello + + diff --git a/VICIDIAL_web/new_listloader_superL.php b/VICIDIAL_web/new_listloader_superL.php new file mode 100644 index 0000000..1f9c919 --- /dev/null +++ b/VICIDIAL_web/new_listloader_superL.php @@ -0,0 +1,747 @@ + LICENSE: GPLv2 +### +### AST GUI lead loader from formatted file +### +### CHANGES +### 50602-1640 - First version created by Joe Johnson +### 51128-1108 - Removed PHP global vars requirement +### 60113-1603 - Fixed a few bugs in Excel import +### +### make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} +$leadfile_name=$_GET["leadfile_name"]; if (!$leadfile_name) {$leadfile_name=$_POST["leadfile_name"];} +# $leadfile=$_GET["leadfile"]; if (!$leadfile) {$leadfile=$_POST["leadfile"];} +$file_layout=$_GET["file_layout"]; if (!$file_layout) {$file_layout=$_POST["file_layout"];} +$OK_to_process=$_GET["OK_to_process"]; if (!$OK_to_process) {$OK_to_process=$_POST["OK_to_process"];} +$vendor_lead_code_field=$_GET["vendor_lead_code_field"]; if (!$vendor_lead_code_field) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +$source_id_field=$_GET["source_id_field"]; if (!$source_id_field) {$source_id_field=$_POST["source_id_field"];} +$list_id_field=$_GET["list_id_field"]; if (!$list_id_field) {$list_id_field=$_POST["list_id_field"];} +$phone_code_field=$_GET["phone_code_field"]; if (!$phone_code_field) {$phone_code_field=$_POST["phone_code_field"];} +$phone_number_field=$_GET["phone_number_field"]; if (!$phone_number_field) {$phone_number_field=$_POST["phone_number_field"];} +$title_field=$_GET["title_field"]; if (!$title_field) {$title_field=$_POST["title_field"];} +$first_name_field=$_GET["first_name_field"]; if (!$first_name_field) {$first_name_field=$_POST["first_name_field"];} +$middle_initial_field=$_GET["middle_initial_field"]; if (!$middle_initial_field) {$middle_initial_field=$_POST["middle_initial_field"];} +$last_name_field=$_GET["last_name_field"]; if (!$last_name_field) {$last_name_field=$_POST["last_name_field"];} +$address1_field=$_GET["address1_field"]; if (!$address1_field) {$address1_field=$_POST["address1_field"];} +$address2_field=$_GET["address2_field"]; if (!$address2_field) {$address2_field=$_POST["address2_field"];} +$address3_field=$_GET["address3_field"]; if (!$address3_field) {$address3_field=$_POST["address3_field"];} +$city_field=$_GET["city_field"]; if (!$city_field) {$city_field=$_POST["city_field"];} +$state_field=$_GET["state_field"]; if (!$state_field) {$state_field=$_POST["state_field"];} +$province_field=$_GET["province_field"]; if (!$province_field) {$province_field=$_POST["province_field"];} +$postal_code_field=$_GET["postal_code_field"]; if (!$postal_code_field) {$postal_code_field=$_POST["postal_code_field"];} +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} +$country_code_field=$_GET["country_code_field"]; if (!$country_code_field) {$country_code_field=$_POST["country_code_field"];} +$gender_field=$_GET["gender_field"]; if (!$gender_field) {$gender_field=$_POST["gender_field"];} +$date_of_birth_field=$_GET["date_of_birth_field"]; if (!$date_of_birth_field) {$date_of_birth_field=$_POST["date_of_birth_field"];} +$alt_phone_field=$_GET["alt_phone_field"]; if (!$alt_phone_field) {$alt_phone_field=$_POST["alt_phone_field"];} +$email_field=$_GET["email_field"]; if (!$email_field) {$email_field=$_POST["email_field"];} +$security_phrase_field=$_GET["security_phrase_field"]; if (!$security_phrase_field) {$security_phrase_field=$_POST["security_phrase_field"];} +$comments_field=$_GET["comments_field"]; if (!$comments_field) {$comments_field=$_POST["comments_field"];} + +$version = '1.1.9'; +$build = '60113-1603'; + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Super Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + + + + + + + + + + + + + + + +
Load leads from this file:
File layout to use:Standard VICIDIAL    Custom layout
        
CLICK HERE TO GO TO THE BASIC LEAD LOADER         BACK TO ADMIN
SUPER LIST LOADER-     VERSION:     BUILD:
+ + +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + print "
Processing Excel file... \n"; + # print "$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"; + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = $row[$alt_phone_field]; + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $total=0; $good=0; $bad=0; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.xls", "r"); + + passthru("$WeBServeRRooT/vicidial/listloader.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $campaign_id = ''; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = $row[19]; + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($phone_number)>8) { + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$campaign_id','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]|\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $tbl_rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.txt", "r"); + print "
Processing $delim_name-delimited file...\n"; + + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } else if (!eregi(".csv", $leadfile_name)) { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl"); + } else { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $file=fopen("$WeBServeRRooT/vicidial/vicidial_temp_file.csv", "r"); + $stmt_file=fopen("listloader_stmts.txt", "w"); + + print "
Processing CSV file... \n"; + + $total=0; $good=0; $bad=0; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($tbl_rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + diff --git a/VICIDIAL_web/record_conf_1_hour.php b/VICIDIAL_web/record_conf_1_hour.php new file mode 100644 index 0000000..f3ccb0c --- /dev/null +++ b/VICIDIAL_web/record_conf_1_hour.php @@ -0,0 +1,124 @@ + LICENSE: GPLv2 +### +# grab: $server_ip $station $session_id + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$station=$_GET["station"]; if (!$station) {$station=$_POST["station"];} +$session_id=$_GET["session_id"]; if (!$session_id) {$session_id=$_POST["session_id"];} +$NEW_RECORDING=$_GET["NEW_RECORDING"]; if (!$NEW_RECORDING) {$NEW_RECORDING=$_POST["NEW_RECORDING"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL RECORD CONFERENCE: 1 hour + + +
+ + 8) && (strlen($session_id) > 3) && (strlen($station) > 3) ) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $conf_silent_prefix = '7'; + $ext_context = 'demo'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','RB$FILE_datetime$station','Channel: $local_DEF$conf_silent_prefix$session_id$local_AMP$ext_context','Context: $ext_context','Exten: 8309','Priority: 1','Callerid: $FILE_datetime$station','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$session_id','$server_ip','$station','$MYSQL_datetime','$secX','$FILE_datetime$station')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "Recording started\n

\n"; + echo "Back to main recording screen\n

\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$station|\n

\n"; + echo "Back to main recording screen\n

\n"; + } +} +else +{ +echo "
Start recording a conference for 1 hour:
\n"; +echo "\n"; +echo "server_ip: | \n"; +echo "session_id: | \n"; +echo "station: | \n"; +echo "\n"; +echo "


\n"; + + + +} +?> + + \ No newline at end of file diff --git a/VICIDIAL_web/remote_dispo.php b/VICIDIAL_web/remote_dispo.php new file mode 100644 index 0000000..1cc2c0c --- /dev/null +++ b/VICIDIAL_web/remote_dispo.php @@ -0,0 +1,277 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$call_began=$_GET["call_began"]; if (!$call_began) {$call_began=$_POST["call_began"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$customer_zap_channel=$_GET["customer_zap_channel"]; if (!$customer_zap_channel) {$customer_zap_channel=$_POST["customer_zap_channel"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$dispo=$_GET["dispo"]; if (!$dispo) {$dispo=$_POST["dispo"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$end_call=$_GET["end_call"]; if (!$end_call) {$end_call=$_POST["end_call"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$phone=$_GET["phone"]; if (!$phone) {$phone=$_POST["phone"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$security=$_GET["security"]; if (!$security) {$security=$_POST["security"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_id=$_GET["session_id"]; if (!$session_id) {$session_id=$_POST["session_id"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$tsr=$_GET["tsr"]; if (!$tsr) {$tsr=$_POST["tsr"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$vendor_id=$_GET["vendor_id"]; if (!$vendor_id) {$vendor_id=$_POST["vendor_id"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + +#$link=mysql_connect("localhost", "cron", "1234"); +#mysql_select_db("asterisk"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='$call_length', status='$status', user='$PHP_AUTH_USER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='$status',first_name='$first_name',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',alt_phone='$alt_phone',email='$email',security_phrase='$security',comments='$comments',user='$PHP_AUTH_USER' where lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='$lead_id'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/VICIDIAL_web/server_stats.php b/VICIDIAL_web/server_stats.php new file mode 100644 index 0000000..1a24a7b --- /dev/null +++ b/VICIDIAL_web/server_stats.php @@ -0,0 +1,69 @@ + LICENSE: GPLv2 +### +require("dbconnect.php"); + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: Server Stats and Reports + +

VICIDIAL: Server Stats and Reports

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/VICIDIAL_web/test.txt b/VICIDIAL_web/test.txt new file mode 100644 index 0000000..70c379b --- /dev/null +++ b/VICIDIAL_web/test.txt @@ -0,0 +1 @@ +Hello world \ No newline at end of file diff --git a/VICIDIAL_web/user_stats.php b/VICIDIAL_web/user_stats.php new file mode 100644 index 0000000..1753cd2 --- /dev/null +++ b/VICIDIAL_web/user_stats.php @@ -0,0 +1,302 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats + + +
+ + + + + +\n"; +echo "
  VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='$user' and call_date >= '$begin_date 0:00:01' and call_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='$user' and event_date >= '$begin_date 0:00:01' and event_date <= '$end_date 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGNHOURS:MINUTES
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "LAST 50 CALLS:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='$user' order by uniqueid desc limit 50;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $u++; + } + + +echo "
DATE/TIME LENGTH STATUS PHONE CAMPAIGN LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/VICIDIAL_web/user_status.php b/VICIDIAL_web/user_status.php new file mode 100644 index 0000000..7fcf684 --- /dev/null +++ b/VICIDIAL_web/user_status.php @@ -0,0 +1,223 @@ + LICENSE: GPLv2 +### + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$begin_date=$_GET["begin_date"]; if (!$begin_date) {$begin_date=$_POST["begin_date"];} +$end_date=$_GET["end_date"]; if (!$end_date) {$end_date=$_POST["end_date"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!$begin_date) {$begin_date = $TODAY;} +if (!$end_date) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + $stmt="SELECT * from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status + + +
+
+ + + + +\n"; +echo "
  VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='$group' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name - \n"; + +echo "VICIDIAL Time Sheet\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/VICIDIAL_web/vdremote.php b/VICIDIAL_web/vdremote.php new file mode 100644 index 0000000..e924078 --- /dev/null +++ b/VICIDIAL_web/vdremote.php @@ -0,0 +1,581 @@ + LICENSE: GPLv2 +### +### Changes +### 50307-1721 - First version +### 51123-1502 - removed requirement of PHP Globals=on +### +### make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$force_logout=$_GET["force_logout"]; if (!$force_logout) {$force_logout=$_POST["force_logout"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} +$remote_agent_id=$_GET["remote_agent_id"]; if (!$remote_agent_id) {$remote_agent_id=$_POST["remote_agent_id"];} +$user_start=$_GET["user_start"]; if (!$user_start) {$user_start=$_POST["user_start"];} +$number_of_lines=$_GET["number_of_lines"]; if (!$number_of_lines) {$number_of_lines=$_POST["number_of_lines"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$status=$_GET["status"]; if (!$status) {$status=$_POST["status"];} +$campaign_id=$_GET["campaign_id"]; if (!$campaign_id) {$campaign_id=$_POST["campaign_id"];} +$groups=$_GET["groups"]; if (!$groups) {$groups=$_POST["groups"];} + +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} + + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + +$popup_page = './closer_popup.php'; +$version = '1.1.9'; +$build = '51123-1502'; +$STARTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rsltx=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rsltx); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rsltx=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rsltx); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|UPDATE vicidial_remote_agents set number_of_lines='$number_of_lines', conf_exten='$conf_exten', status='$status', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='$server_ip' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc/active_list_refresh.php b/agc/active_list_refresh.php new file mode 100644 index 0000000..7c8757a --- /dev/null +++ b/agc/active_list_refresh.php @@ -0,0 +1,448 @@ + LICENSE: GPLv2 +### +### This script is designed purely to serve updates of the live data to the display scripts +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ADD - ('1','2','3','4','5') +### - $order - ('asc','desc') +### - $format - ('text','table','menu','selectlist','textarea') +### - $bgcolor - ('#123456','white','black','etc...') +### - $txtcolor - ('#654321','black','white','etc...') +### - $txtsize - ('1','2','3','etc...') +### - $selectsize - ('2','3','4','etc...') +### - $selectfontsize - ('8','10','12','etc...') +### - $selectedext - ('cc100') +### - $selectedtrunk - ('Zap/25-1') +### - $selectedlocal - ('SIP/cc100') +### - $textareaheight - ('8','10','12','etc...') +### - $textareawidth - ('8','10','12','etc...') +### - $field_name - ('extension','busyext','extension_xfer','etc...') +### + +# changes +# 50323-1147 First build of script +# 50401-1132 small formatting changes +# 50502-1402 added field_name as modifiable variable +# 50503-1213 added session_name checking for extra security +# 50503-1311 added conferences list +# 50610-1155 Added NULL check on MySQL results to reduced errors +# 50711-1209 removed HTTP authentication in favor of user/pass vars +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ADD=$_GET["ADD"]; if (!$ADD) {$ADD=$_POST["ADD"];} +$order=$_GET["order"]; if (!$order) {$order=$_POST["order"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$bgcolor=$_GET["bgcolor"]; if (!$bgcolor) {$bgcolor=$_POST["bgcolor"];} +$txtcolor=$_GET["txtcolor"]; if (!$txtcolor) {$txtcolor=$_POST["txtcolor"];} +$txtsize=$_GET["txtsize"]; if (!$txtsize) {$txtsize=$_POST["txtsize"];} +$selectsize=$_GET["selectsize"]; if (!$selectsize) {$selectsize=$_POST["selectsize"];} +$selectfontsize=$_GET["selectfontsize"]; if (!$selectfontsize) {$selectfontsize=$_POST["selectfontsize"];} +$selectedext=$_GET["selectedext"]; if (!$selectedext) {$selectedext=$_POST["selectedext"];} +$selectedtrunk=$_GET["selectedtrunk"]; if (!$selectedtrunk) {$selectedtrunk=$_POST["selectedtrunk"];} +$selectedlocal=$_GET["selectedlocal"]; if (!$selectedlocal) {$selectedlocal=$_POST["selectedlocal"];} +$textareaheight=$_GET["textareaheight"]; if (!$textareaheight) {$textareaheight=$_POST["textareaheight"];} +$textareawidth=$_GET["textareawidth"]; if (!$textareawidth) {$textareawidth=$_POST["textareawidth"];} +$field_name=$_GET["field_name"]; if (!$field_name) {$field_name=$_POST["field_name"];} + +# default optional vars if not set +if (!$ADD) {$ADD="1";} +if (!$order) {$order='desc';} +if (!$format) {$format='table';} +if (!$bgcolor) {$bgcolor='white';} +if (!$txtcolor) {$txtcolor='black';} +if (!$txtsize) {$txtsize='2';} +if (!$selectsize) {$selectsize='4';} +if (!$selectfontsize) {$selectfontsize='10';} +if (!$textareaheight) {$textareaheight='10';} +if (!$textareawidth) {$textareawidth='20';} + + +$version = '0.0.6'; +$build = '50711-1209'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "List Display: "; +if ($ADD==1) {echo "Live Extensions";} +if ($ADD==2) {echo "Busy Extensions";} +if ($ADD==3) {echo "Outside Lines";} +if ($ADD==4) {echo "Local Extensions";} +if ($ADD==5) {echo "Conferences";} +if ($ADD==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc/astguiclient.php b/agc/astguiclient.php new file mode 100644 index 0000000..17abe6c --- /dev/null +++ b/agc/astguiclient.php @@ -0,0 +1,2876 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass +### +### Other scripts that this application depends on: +### - active_list_refresh.php: displays active/live channels and phones +### - manager_send.php: sends Actions to be executed on Asterisk servers +### - live_exten_check.php: checks to see if user's phone is on a live call +### - call_log_display.php: retrieves log of inbound and outbound calls +### - voicemail_check.php: retrieves counts of new and old messages +### - inbound_popup.php: opens upon live_inbound call coming in +### - conf_exten_check.php: checks to see if and calls are in a specific conf +### - park_calls_display.php: retrieves list of parked calls +### - vdc_db_query.php: Changes values in the DB for non-calling records +### +### CHANGES +### 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +### 50323-1411 - First build version display-only +### 50331-1040 - Second-build, added phone login and hangup/hijack display +### 50401-1006 - Trunk/Local Hangup functions enabled +### 50404-1056 - Trunk/Local Hijack functions enabled +### 50404-1459 - Simple live calls display and grabs updated time from server +### 50405-1221 - Reorganized the display and layers, added some images +### 50406-1005 - Added In/Out call log display to MAIN panel +### 50407-1254 - Start/Stop Recording on live calls enabled +### 50422-1101 - Activated Check Voicemail button and new/old messages count +### 50428-1449 - Added dial from log and basic live_inbound call popup +### 50429-1455 - Modified inbound popup code for IE and to add more functions +### 50502-1442 - Added basic method to transfer live calls somewhere else +### 50503-1205 - Added web_client_sessions entry for more security of subscripts +### 50503-1537 - Added basic conferences display +### 50509-1132 - Added conference connected list and hangup/xfer for them +### 50511-1129 - Added registration of conference rooms and added manual dial +### 50523-1342 - Added Conference recording and send DTMF +### 50523-1622 - Added Local Dial window frame for calling local extensions +### 50524-1456 - Added ability to park call and display number of parked calls +### 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +### 50525-1224 - Added ability to place outbound call from within conferene +### 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +### 50711-1229 - removed HTTP authentication in favor of user/pass vars +### 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +### 50804-1604 - Minor bug fix in inbound_popup functions +### 50818-1715 - Added pretty login section +### 50913-1137 - Added custom outbound_cid from phones table +### 51110-1430 - Fixed non-standard http port issue +### 60103-1421 - Added code for favorite extensions chooser +### 60104-1347 - Added basic layout for favorites editing frame +### 60105-1124 - Finished Favorites frame and added DB submission +### 60112-1622 - Several formatting changes +### + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$phone_login=$_GET["phone_login"]; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET["phone_pass"]; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$relogin=$_GET["relogin"]; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '1.1.9'; +$build = '60112-1622'; + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $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); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +$fp = fopen ("./astguiclient_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + 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'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + + + + + + + + + + + + + + + + diff --git a/agc/call_log_display.php b/agc/call_log_display.php new file mode 100644 index 0000000..e2a578a --- /dev/null +++ b/agc/call_log_display.php @@ -0,0 +1,183 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send the inbound and outbound calls for a specific phone +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +### - $protocol - ('SIP','Zap','IAX2',...) +### - $in_limit - ('10','20','50','100',...) +### - $out_limit - ('10','20','50','100',...) +### + +# changes +# 50406-1013 First build of script +# 50407-1452 Added definable limits +# 50503-1236 added session_name checking for extra security +# 50610-1158 Added NULL check on MySQL results to reduced errors +# 50711-1202 removed HTTP authentication in favor of user/pass vars +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} + +# default optional vars if not set +if (!$format) {$format="text";} +if (!$in_limit) {$in_limit="100";} +if (!$out_limit) {$out_limit="100";} + +$version = '0.0.5'; +$build = '50711-1202'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc/conf_exten_check.php b/agc/conf_exten_check.php new file mode 100644 index 0000000..0735b92 --- /dev/null +++ b/agc/conf_exten_check.php @@ -0,0 +1,215 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('refresh','register') +### - $client - ('agc','vdc') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $auto_dial_level - ('0','1','1.2',...) +### + +# changes +# 50509-1054 First build of script +# 50511-1112 Added ability to register a conference room +# 50610-1159 Added NULL check on MySQL results to reduced errors +# 50706-1429 script changed to not use HTTP login vars, user/pass instead +# 50706-1525 Added date-time display for vicidial client display +# 50816-1500 Added random update to vicidial_live_agents table for vdc users +# 51121-1353 Altered echo statements for several small PHP speed optimizations +# + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$client=$_GET["client"]; if (!$client) {$client=$_POST["client"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} + +# default optional vars if not set +if (!$format) {$format="text";} +if (!$ACTION) {$ACTION="refresh";} +if (!$client) {$client="agc";} + +$version = '0.0.7'; +$build = '51121-1353'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd_His"); +if (!$query_date) {$query_date = $NOW_DATE;} +$random = (rand(1000000, 9999999) + 10000000); + + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; + } + + echo "$countecho\n"; + } + + if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten is not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc/dbconnect.php b/agc/dbconnect.php new file mode 100644 index 0000000..1e7e344 --- /dev/null +++ b/agc/dbconnect.php @@ -0,0 +1,18 @@ + LICENSE: GPLv2 +### +$link=mysql_connect("localhost", "cron", "1234"); +mysql_select_db("asterisk"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; + +#$WeBServeRRooT = '/home/www/htdocs'; +$WeBServeRRooT = '/usr/local/apache2/htdocs'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc/images/agc_check_voicemail_BLINK.gif b/agc/images/agc_check_voicemail_BLINK.gif new file mode 100644 index 0000000..30703a7 Binary files /dev/null and b/agc/images/agc_check_voicemail_BLINK.gif differ diff --git a/agc/images/agc_check_voicemail_BLINK_es.gif b/agc/images/agc_check_voicemail_BLINK_es.gif new file mode 100644 index 0000000..600cef8 Binary files /dev/null and b/agc/images/agc_check_voicemail_BLINK_es.gif differ diff --git a/agc/images/agc_check_voicemail_OFF.gif b/agc/images/agc_check_voicemail_OFF.gif new file mode 100644 index 0000000..5b7e4c7 Binary files /dev/null and b/agc/images/agc_check_voicemail_OFF.gif differ diff --git a/agc/images/agc_check_voicemail_OFF_es.gif b/agc/images/agc_check_voicemail_OFF_es.gif new file mode 100644 index 0000000..ec9c1d5 Binary files /dev/null and b/agc/images/agc_check_voicemail_OFF_es.gif differ diff --git a/agc/images/agc_check_voicemail_ON.gif b/agc/images/agc_check_voicemail_ON.gif new file mode 100644 index 0000000..ad55916 Binary files /dev/null and b/agc/images/agc_check_voicemail_ON.gif differ diff --git a/agc/images/agc_check_voicemail_ON_es.gif b/agc/images/agc_check_voicemail_ON_es.gif new file mode 100644 index 0000000..442a808 Binary files /dev/null and b/agc/images/agc_check_voicemail_ON_es.gif differ diff --git a/agc/images/agc_live_call_OFF.gif b/agc/images/agc_live_call_OFF.gif new file mode 100644 index 0000000..3752fb5 Binary files /dev/null and b/agc/images/agc_live_call_OFF.gif differ diff --git a/agc/images/agc_live_call_OFF_es.gif b/agc/images/agc_live_call_OFF_es.gif new file mode 100644 index 0000000..1ff376d Binary files /dev/null and b/agc/images/agc_live_call_OFF_es.gif differ diff --git a/agc/images/agc_live_call_ON.gif b/agc/images/agc_live_call_ON.gif new file mode 100644 index 0000000..ed8ba2d Binary files /dev/null and b/agc/images/agc_live_call_ON.gif differ diff --git a/agc/images/agc_live_call_ON_es.gif b/agc/images/agc_live_call_ON_es.gif new file mode 100644 index 0000000..041d398 Binary files /dev/null and b/agc/images/agc_live_call_ON_es.gif differ diff --git a/agc/images/agc_tab_active_lines.gif b/agc/images/agc_tab_active_lines.gif new file mode 100644 index 0000000..9f8eaf6 Binary files /dev/null and b/agc/images/agc_tab_active_lines.gif differ diff --git a/agc/images/agc_tab_active_lines_es.gif b/agc/images/agc_tab_active_lines_es.gif new file mode 100644 index 0000000..bdefd01 Binary files /dev/null and b/agc/images/agc_tab_active_lines_es.gif differ diff --git a/agc/images/agc_tab_astguiclient.gif b/agc/images/agc_tab_astguiclient.gif new file mode 100644 index 0000000..3037357 Binary files /dev/null and b/agc/images/agc_tab_astguiclient.gif differ diff --git a/agc/images/agc_tab_conferences.gif b/agc/images/agc_tab_conferences.gif new file mode 100644 index 0000000..e3c8066 Binary files /dev/null and b/agc/images/agc_tab_conferences.gif differ diff --git a/agc/images/agc_tab_conferences_es.gif b/agc/images/agc_tab_conferences_es.gif new file mode 100644 index 0000000..14ab717 Binary files /dev/null and b/agc/images/agc_tab_conferences_es.gif differ diff --git a/agc/images/agc_tab_main.gif b/agc/images/agc_tab_main.gif new file mode 100644 index 0000000..6e687e4 Binary files /dev/null and b/agc/images/agc_tab_main.gif differ diff --git a/agc/images/agc_tab_main_es.gif b/agc/images/agc_tab_main_es.gif new file mode 100644 index 0000000..b5fc2a5 Binary files /dev/null and b/agc/images/agc_tab_main_es.gif differ diff --git a/agc/images/blank.gif b/agc/images/blank.gif new file mode 100644 index 0000000..3a46969 Binary files /dev/null and b/agc/images/blank.gif differ diff --git a/agc/images/de.gif b/agc/images/de.gif new file mode 100644 index 0000000..4dd34f6 Binary files /dev/null and b/agc/images/de.gif differ diff --git a/agc/images/down.gif b/agc/images/down.gif new file mode 100644 index 0000000..32d0a00 Binary files /dev/null and b/agc/images/down.gif differ diff --git a/agc/images/el.gif b/agc/images/el.gif new file mode 100644 index 0000000..9e79d8b Binary files /dev/null and b/agc/images/el.gif differ diff --git a/agc/images/en.gif b/agc/images/en.gif new file mode 100644 index 0000000..cb45f5f Binary files /dev/null and b/agc/images/en.gif differ diff --git a/agc/images/es.gif b/agc/images/es.gif new file mode 100644 index 0000000..308ea3c Binary files /dev/null and b/agc/images/es.gif differ diff --git a/agc/images/fr.gif b/agc/images/fr.gif new file mode 100644 index 0000000..21fb3d1 Binary files /dev/null and b/agc/images/fr.gif differ diff --git a/agc/images/it.gif b/agc/images/it.gif new file mode 100644 index 0000000..6c7b179 Binary files /dev/null and b/agc/images/it.gif differ diff --git a/agc/images/pt.gif b/agc/images/pt.gif new file mode 100644 index 0000000..646b76a Binary files /dev/null and b/agc/images/pt.gif differ diff --git a/agc/images/remove.gif b/agc/images/remove.gif new file mode 100644 index 0000000..89b0521 Binary files /dev/null and b/agc/images/remove.gif differ diff --git a/agc/images/up.gif b/agc/images/up.gif new file mode 100644 index 0000000..0d55544 Binary files /dev/null and b/agc/images/up.gif differ diff --git a/agc/images/vdc_LB_dialnextnumber.gif b/agc/images/vdc_LB_dialnextnumber.gif new file mode 100644 index 0000000..a5a080d Binary files /dev/null and b/agc/images/vdc_LB_dialnextnumber.gif differ diff --git a/agc/images/vdc_LB_dialnextnumber_OFF.gif b/agc/images/vdc_LB_dialnextnumber_OFF.gif new file mode 100644 index 0000000..75bc0e8 Binary files /dev/null and b/agc/images/vdc_LB_dialnextnumber_OFF.gif differ diff --git a/agc/images/vdc_LB_dialnextnumber_OFF_es.gif b/agc/images/vdc_LB_dialnextnumber_OFF_es.gif new file mode 100644 index 0000000..405ff33 Binary files /dev/null and b/agc/images/vdc_LB_dialnextnumber_OFF_es.gif differ diff --git a/agc/images/vdc_LB_dialnextnumber_es.gif b/agc/images/vdc_LB_dialnextnumber_es.gif new file mode 100644 index 0000000..ca92716 Binary files /dev/null and b/agc/images/vdc_LB_dialnextnumber_es.gif differ diff --git a/agc/images/vdc_LB_grabparkedcall.gif b/agc/images/vdc_LB_grabparkedcall.gif new file mode 100644 index 0000000..a677925 Binary files /dev/null and b/agc/images/vdc_LB_grabparkedcall.gif differ diff --git a/agc/images/vdc_LB_grabparkedcall_OFF.gif b/agc/images/vdc_LB_grabparkedcall_OFF.gif new file mode 100644 index 0000000..74b1f5a Binary files /dev/null and b/agc/images/vdc_LB_grabparkedcall_OFF.gif differ diff --git a/agc/images/vdc_LB_grabparkedcall_OFF_es.gif b/agc/images/vdc_LB_grabparkedcall_OFF_es.gif new file mode 100644 index 0000000..21991dd Binary files /dev/null and b/agc/images/vdc_LB_grabparkedcall_OFF_es.gif differ diff --git a/agc/images/vdc_LB_grabparkedcall_es.gif b/agc/images/vdc_LB_grabparkedcall_es.gif new file mode 100644 index 0000000..9acc363 Binary files /dev/null and b/agc/images/vdc_LB_grabparkedcall_es.gif differ diff --git a/agc/images/vdc_LB_hangupcustomer.gif b/agc/images/vdc_LB_hangupcustomer.gif new file mode 100644 index 0000000..b4fdfae Binary files /dev/null and b/agc/images/vdc_LB_hangupcustomer.gif differ diff --git a/agc/images/vdc_LB_hangupcustomer_OFF.gif b/agc/images/vdc_LB_hangupcustomer_OFF.gif new file mode 100644 index 0000000..e5736ae Binary files /dev/null and b/agc/images/vdc_LB_hangupcustomer_OFF.gif differ diff --git a/agc/images/vdc_LB_hangupcustomer_OFF_es.gif b/agc/images/vdc_LB_hangupcustomer_OFF_es.gif new file mode 100644 index 0000000..570a6e5 Binary files /dev/null and b/agc/images/vdc_LB_hangupcustomer_OFF_es.gif differ diff --git a/agc/images/vdc_LB_hangupcustomer_es.gif b/agc/images/vdc_LB_hangupcustomer_es.gif new file mode 100644 index 0000000..94d3e22 Binary files /dev/null and b/agc/images/vdc_LB_hangupcustomer_es.gif differ diff --git a/agc/images/vdc_LB_parkcall.gif b/agc/images/vdc_LB_parkcall.gif new file mode 100644 index 0000000..88fee28 Binary files /dev/null and b/agc/images/vdc_LB_parkcall.gif differ diff --git a/agc/images/vdc_LB_parkcall_OFF.gif b/agc/images/vdc_LB_parkcall_OFF.gif new file mode 100644 index 0000000..8ad5501 Binary files /dev/null and b/agc/images/vdc_LB_parkcall_OFF.gif differ diff --git a/agc/images/vdc_LB_parkcall_OFF_es.gif b/agc/images/vdc_LB_parkcall_OFF_es.gif new file mode 100644 index 0000000..110ce6b Binary files /dev/null and b/agc/images/vdc_LB_parkcall_OFF_es.gif differ diff --git a/agc/images/vdc_LB_parkcall_es.gif b/agc/images/vdc_LB_parkcall_es.gif new file mode 100644 index 0000000..2274a27 Binary files /dev/null and b/agc/images/vdc_LB_parkcall_es.gif differ diff --git a/agc/images/vdc_LB_pause.gif b/agc/images/vdc_LB_pause.gif new file mode 100644 index 0000000..3486a1c Binary files /dev/null and b/agc/images/vdc_LB_pause.gif differ diff --git a/agc/images/vdc_LB_pause_OFF.gif b/agc/images/vdc_LB_pause_OFF.gif new file mode 100644 index 0000000..fce0304 Binary files /dev/null and b/agc/images/vdc_LB_pause_OFF.gif differ diff --git a/agc/images/vdc_LB_pause_OFF_es.gif b/agc/images/vdc_LB_pause_OFF_es.gif new file mode 100644 index 0000000..494d68a Binary files /dev/null and b/agc/images/vdc_LB_pause_OFF_es.gif differ diff --git a/agc/images/vdc_LB_pause_es.gif b/agc/images/vdc_LB_pause_es.gif new file mode 100644 index 0000000..544a379 Binary files /dev/null and b/agc/images/vdc_LB_pause_es.gif differ diff --git a/agc/images/vdc_LB_resume.gif b/agc/images/vdc_LB_resume.gif new file mode 100644 index 0000000..a7d75dd Binary files /dev/null and b/agc/images/vdc_LB_resume.gif differ diff --git a/agc/images/vdc_LB_resume_OFF.gif b/agc/images/vdc_LB_resume_OFF.gif new file mode 100644 index 0000000..0ae4cb9 Binary files /dev/null and b/agc/images/vdc_LB_resume_OFF.gif differ diff --git a/agc/images/vdc_LB_resume_OFF_es.gif b/agc/images/vdc_LB_resume_OFF_es.gif new file mode 100644 index 0000000..921d5d5 Binary files /dev/null and b/agc/images/vdc_LB_resume_OFF_es.gif differ diff --git a/agc/images/vdc_LB_resume_es.gif b/agc/images/vdc_LB_resume_es.gif new file mode 100644 index 0000000..1b09614 Binary files /dev/null and b/agc/images/vdc_LB_resume_es.gif differ diff --git a/agc/images/vdc_LB_senddtmf.gif b/agc/images/vdc_LB_senddtmf.gif new file mode 100644 index 0000000..d19888a Binary files /dev/null and b/agc/images/vdc_LB_senddtmf.gif differ diff --git a/agc/images/vdc_LB_senddtmf_OFF.gif b/agc/images/vdc_LB_senddtmf_OFF.gif new file mode 100644 index 0000000..08a4b39 Binary files /dev/null and b/agc/images/vdc_LB_senddtmf_OFF.gif differ diff --git a/agc/images/vdc_LB_senddtmf_OFF_es.gif b/agc/images/vdc_LB_senddtmf_OFF_es.gif new file mode 100644 index 0000000..2d32c5e Binary files /dev/null and b/agc/images/vdc_LB_senddtmf_OFF_es.gif differ diff --git a/agc/images/vdc_LB_senddtmf_es.gif b/agc/images/vdc_LB_senddtmf_es.gif new file mode 100644 index 0000000..43964df Binary files /dev/null and b/agc/images/vdc_LB_senddtmf_es.gif differ diff --git a/agc/images/vdc_LB_spacer.gif b/agc/images/vdc_LB_spacer.gif new file mode 100644 index 0000000..d0a4f6e Binary files /dev/null and b/agc/images/vdc_LB_spacer.gif differ diff --git a/agc/images/vdc_LB_startrecording.gif b/agc/images/vdc_LB_startrecording.gif new file mode 100644 index 0000000..022103d Binary files /dev/null and b/agc/images/vdc_LB_startrecording.gif differ diff --git a/agc/images/vdc_LB_startrecording_OFF.gif b/agc/images/vdc_LB_startrecording_OFF.gif new file mode 100644 index 0000000..3ee4ca6 Binary files /dev/null and b/agc/images/vdc_LB_startrecording_OFF.gif differ diff --git a/agc/images/vdc_LB_startrecording_OFF_es.gif b/agc/images/vdc_LB_startrecording_OFF_es.gif new file mode 100644 index 0000000..ff9a344 Binary files /dev/null and b/agc/images/vdc_LB_startrecording_OFF_es.gif differ diff --git a/agc/images/vdc_LB_startrecording_es.gif b/agc/images/vdc_LB_startrecording_es.gif new file mode 100644 index 0000000..26420f7 Binary files /dev/null and b/agc/images/vdc_LB_startrecording_es.gif differ diff --git a/agc/images/vdc_LB_stoprecording.gif b/agc/images/vdc_LB_stoprecording.gif new file mode 100644 index 0000000..6f3bfed Binary files /dev/null and b/agc/images/vdc_LB_stoprecording.gif differ diff --git a/agc/images/vdc_LB_stoprecording_OFF.gif b/agc/images/vdc_LB_stoprecording_OFF.gif new file mode 100644 index 0000000..2e1efe4 Binary files /dev/null and b/agc/images/vdc_LB_stoprecording_OFF.gif differ diff --git a/agc/images/vdc_LB_stoprecording_OFF_es.gif b/agc/images/vdc_LB_stoprecording_OFF_es.gif new file mode 100644 index 0000000..2806311 Binary files /dev/null and b/agc/images/vdc_LB_stoprecording_OFF_es.gif differ diff --git a/agc/images/vdc_LB_stoprecording_es.gif b/agc/images/vdc_LB_stoprecording_es.gif new file mode 100644 index 0000000..94f9de9 Binary files /dev/null and b/agc/images/vdc_LB_stoprecording_es.gif differ diff --git a/agc/images/vdc_LB_transferconf.gif b/agc/images/vdc_LB_transferconf.gif new file mode 100644 index 0000000..c573851 Binary files /dev/null and b/agc/images/vdc_LB_transferconf.gif differ diff --git a/agc/images/vdc_LB_transferconf_OFF.gif b/agc/images/vdc_LB_transferconf_OFF.gif new file mode 100644 index 0000000..dd0a579 Binary files /dev/null and b/agc/images/vdc_LB_transferconf_OFF.gif differ diff --git a/agc/images/vdc_LB_transferconf_OFF_es.gif b/agc/images/vdc_LB_transferconf_OFF_es.gif new file mode 100644 index 0000000..d0a54bf Binary files /dev/null and b/agc/images/vdc_LB_transferconf_OFF_es.gif differ diff --git a/agc/images/vdc_LB_transferconf_es.gif b/agc/images/vdc_LB_transferconf_es.gif new file mode 100644 index 0000000..10cfa49 Binary files /dev/null and b/agc/images/vdc_LB_transferconf_es.gif differ diff --git a/agc/images/vdc_LB_webform.gif b/agc/images/vdc_LB_webform.gif new file mode 100644 index 0000000..4d5228f Binary files /dev/null and b/agc/images/vdc_LB_webform.gif differ diff --git a/agc/images/vdc_LB_webform_OFF.gif b/agc/images/vdc_LB_webform_OFF.gif new file mode 100644 index 0000000..64316ce Binary files /dev/null and b/agc/images/vdc_LB_webform_OFF.gif differ diff --git a/agc/images/vdc_LB_webform_OFF_es.gif b/agc/images/vdc_LB_webform_OFF_es.gif new file mode 100644 index 0000000..75a5619 Binary files /dev/null and b/agc/images/vdc_LB_webform_OFF_es.gif differ diff --git a/agc/images/vdc_LB_webform_es.gif b/agc/images/vdc_LB_webform_es.gif new file mode 100644 index 0000000..d7590d6 Binary files /dev/null and b/agc/images/vdc_LB_webform_es.gif differ diff --git a/agc/images/vdc_XB_ammessage.gif b/agc/images/vdc_XB_ammessage.gif new file mode 100644 index 0000000..484d01e Binary files /dev/null and b/agc/images/vdc_XB_ammessage.gif differ diff --git a/agc/images/vdc_XB_ammessage_OFF.gif b/agc/images/vdc_XB_ammessage_OFF.gif new file mode 100644 index 0000000..3aa9480 Binary files /dev/null and b/agc/images/vdc_XB_ammessage_OFF.gif differ diff --git a/agc/images/vdc_XB_blindtransfer.gif b/agc/images/vdc_XB_blindtransfer.gif new file mode 100644 index 0000000..77c03e0 Binary files /dev/null and b/agc/images/vdc_XB_blindtransfer.gif differ diff --git a/agc/images/vdc_XB_blindtransfer_OFF.gif b/agc/images/vdc_XB_blindtransfer_OFF.gif new file mode 100644 index 0000000..7fb481e Binary files /dev/null and b/agc/images/vdc_XB_blindtransfer_OFF.gif differ diff --git a/agc/images/vdc_XB_blindtransfer_OFF_es.gif b/agc/images/vdc_XB_blindtransfer_OFF_es.gif new file mode 100644 index 0000000..05adaac Binary files /dev/null and b/agc/images/vdc_XB_blindtransfer_OFF_es.gif differ diff --git a/agc/images/vdc_XB_blindtransfer_es.gif b/agc/images/vdc_XB_blindtransfer_es.gif new file mode 100644 index 0000000..fdad633 Binary files /dev/null and b/agc/images/vdc_XB_blindtransfer_es.gif differ diff --git a/agc/images/vdc_XB_channel.gif b/agc/images/vdc_XB_channel.gif new file mode 100644 index 0000000..9a9ce7b Binary files /dev/null and b/agc/images/vdc_XB_channel.gif differ diff --git a/agc/images/vdc_XB_channel_es.gif b/agc/images/vdc_XB_channel_es.gif new file mode 100644 index 0000000..a4fbf1f Binary files /dev/null and b/agc/images/vdc_XB_channel_es.gif differ diff --git a/agc/images/vdc_XB_code.gif b/agc/images/vdc_XB_code.gif new file mode 100644 index 0000000..8fb2b8c Binary files /dev/null and b/agc/images/vdc_XB_code.gif differ diff --git a/agc/images/vdc_XB_dialwithcustomer.gif b/agc/images/vdc_XB_dialwithcustomer.gif new file mode 100644 index 0000000..68697ed Binary files /dev/null and b/agc/images/vdc_XB_dialwithcustomer.gif differ diff --git a/agc/images/vdc_XB_dialwithcustomer_OFF.gif b/agc/images/vdc_XB_dialwithcustomer_OFF.gif new file mode 100644 index 0000000..8bf2e44 Binary files /dev/null and b/agc/images/vdc_XB_dialwithcustomer_OFF.gif differ diff --git a/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif b/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif new file mode 100644 index 0000000..7ef98a9 Binary files /dev/null and b/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif differ diff --git a/agc/images/vdc_XB_dialwithcustomer_es.gif b/agc/images/vdc_XB_dialwithcustomer_es.gif new file mode 100644 index 0000000..d71bca1 Binary files /dev/null and b/agc/images/vdc_XB_dialwithcustomer_es.gif differ diff --git a/agc/images/vdc_XB_hangupbothlines.gif b/agc/images/vdc_XB_hangupbothlines.gif new file mode 100644 index 0000000..4e6db07 Binary files /dev/null and b/agc/images/vdc_XB_hangupbothlines.gif differ diff --git a/agc/images/vdc_XB_hangupbothlines_OFF.gif b/agc/images/vdc_XB_hangupbothlines_OFF.gif new file mode 100644 index 0000000..f1ffdc1 Binary files /dev/null and b/agc/images/vdc_XB_hangupbothlines_OFF.gif differ diff --git a/agc/images/vdc_XB_hangupbothlines_OFF_es.gif b/agc/images/vdc_XB_hangupbothlines_OFF_es.gif new file mode 100644 index 0000000..8f12acc Binary files /dev/null and b/agc/images/vdc_XB_hangupbothlines_OFF_es.gif differ diff --git a/agc/images/vdc_XB_hangupbothlines_es.gif b/agc/images/vdc_XB_hangupbothlines_es.gif new file mode 100644 index 0000000..646c876 Binary files /dev/null and b/agc/images/vdc_XB_hangupbothlines_es.gif differ diff --git a/agc/images/vdc_XB_hangupxferline.gif b/agc/images/vdc_XB_hangupxferline.gif new file mode 100644 index 0000000..d25a105 Binary files /dev/null and b/agc/images/vdc_XB_hangupxferline.gif differ diff --git a/agc/images/vdc_XB_hangupxferline_OFF.gif b/agc/images/vdc_XB_hangupxferline_OFF.gif new file mode 100644 index 0000000..a8fb4a3 Binary files /dev/null and b/agc/images/vdc_XB_hangupxferline_OFF.gif differ diff --git a/agc/images/vdc_XB_hangupxferline_OFF_es.gif b/agc/images/vdc_XB_hangupxferline_OFF_es.gif new file mode 100644 index 0000000..3c717d0 Binary files /dev/null and b/agc/images/vdc_XB_hangupxferline_OFF_es.gif differ diff --git a/agc/images/vdc_XB_hangupxferline_es.gif b/agc/images/vdc_XB_hangupxferline_es.gif new file mode 100644 index 0000000..0d92a89 Binary files /dev/null and b/agc/images/vdc_XB_hangupxferline_es.gif differ diff --git a/agc/images/vdc_XB_header.gif b/agc/images/vdc_XB_header.gif new file mode 100644 index 0000000..c813b9a Binary files /dev/null and b/agc/images/vdc_XB_header.gif differ diff --git a/agc/images/vdc_XB_header_es.gif b/agc/images/vdc_XB_header_es.gif new file mode 100644 index 0000000..a92c2df Binary files /dev/null and b/agc/images/vdc_XB_header_es.gif differ diff --git a/agc/images/vdc_XB_hotkeysactive.gif b/agc/images/vdc_XB_hotkeysactive.gif new file mode 100644 index 0000000..8382205 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysactive.gif differ diff --git a/agc/images/vdc_XB_hotkeysactive_OFF.gif b/agc/images/vdc_XB_hotkeysactive_OFF.gif new file mode 100644 index 0000000..3357ed2 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysactive_OFF.gif differ diff --git a/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif b/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif new file mode 100644 index 0000000..638ef85 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif differ diff --git a/agc/images/vdc_XB_hotkeysactive_OFF_es.gif b/agc/images/vdc_XB_hotkeysactive_OFF_es.gif new file mode 100644 index 0000000..5c9a312 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysactive_OFF_es.gif differ diff --git a/agc/images/vdc_XB_hotkeysactive_es.gif b/agc/images/vdc_XB_hotkeysactive_es.gif new file mode 100644 index 0000000..b064725 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysactive_es.gif differ diff --git a/agc/images/vdc_XB_hotkeysinactive_es.gif b/agc/images/vdc_XB_hotkeysinactive_es.gif new file mode 100644 index 0000000..d0bf982 Binary files /dev/null and b/agc/images/vdc_XB_hotkeysinactive_es.gif differ diff --git a/agc/images/vdc_XB_internalcloser.gif b/agc/images/vdc_XB_internalcloser.gif new file mode 100644 index 0000000..a1adca7 Binary files /dev/null and b/agc/images/vdc_XB_internalcloser.gif differ diff --git a/agc/images/vdc_XB_internalcloser_OFF.gif b/agc/images/vdc_XB_internalcloser_OFF.gif new file mode 100644 index 0000000..9d3489f Binary files /dev/null and b/agc/images/vdc_XB_internalcloser_OFF.gif differ diff --git a/agc/images/vdc_XB_internalcloser_OFF_es.gif b/agc/images/vdc_XB_internalcloser_OFF_es.gif new file mode 100644 index 0000000..45bc429 Binary files /dev/null and b/agc/images/vdc_XB_internalcloser_OFF_es.gif differ diff --git a/agc/images/vdc_XB_internalcloser_es.gif b/agc/images/vdc_XB_internalcloser_es.gif new file mode 100644 index 0000000..d5c0565 Binary files /dev/null and b/agc/images/vdc_XB_internalcloser_es.gif differ diff --git a/agc/images/vdc_XB_leave3waycall.gif b/agc/images/vdc_XB_leave3waycall.gif new file mode 100644 index 0000000..7bca06f Binary files /dev/null and b/agc/images/vdc_XB_leave3waycall.gif differ diff --git a/agc/images/vdc_XB_leave3waycall_OFF.gif b/agc/images/vdc_XB_leave3waycall_OFF.gif new file mode 100644 index 0000000..63594d6 Binary files /dev/null and b/agc/images/vdc_XB_leave3waycall_OFF.gif differ diff --git a/agc/images/vdc_XB_leave3waycall_OFF_es.gif b/agc/images/vdc_XB_leave3waycall_OFF_es.gif new file mode 100644 index 0000000..9c41a29 Binary files /dev/null and b/agc/images/vdc_XB_leave3waycall_OFF_es.gif differ diff --git a/agc/images/vdc_XB_leave3waycall_es.gif b/agc/images/vdc_XB_leave3waycall_es.gif new file mode 100644 index 0000000..9aa2970 Binary files /dev/null and b/agc/images/vdc_XB_leave3waycall_es.gif differ diff --git a/agc/images/vdc_XB_localcloser.gif b/agc/images/vdc_XB_localcloser.gif new file mode 100644 index 0000000..0e10a2a Binary files /dev/null and b/agc/images/vdc_XB_localcloser.gif differ diff --git a/agc/images/vdc_XB_localcloser_OFF.gif b/agc/images/vdc_XB_localcloser_OFF.gif new file mode 100644 index 0000000..ed11b7a Binary files /dev/null and b/agc/images/vdc_XB_localcloser_OFF.gif differ diff --git a/agc/images/vdc_XB_localcloser_OFF_es.gif b/agc/images/vdc_XB_localcloser_OFF_es.gif new file mode 100644 index 0000000..fbad052 Binary files /dev/null and b/agc/images/vdc_XB_localcloser_OFF_es.gif differ diff --git a/agc/images/vdc_XB_localcloser_es.gif b/agc/images/vdc_XB_localcloser_es.gif new file mode 100644 index 0000000..d36e194 Binary files /dev/null and b/agc/images/vdc_XB_localcloser_es.gif differ diff --git a/agc/images/vdc_XB_number.gif b/agc/images/vdc_XB_number.gif new file mode 100644 index 0000000..33f3033 Binary files /dev/null and b/agc/images/vdc_XB_number.gif differ diff --git a/agc/images/vdc_XB_number_es.gif b/agc/images/vdc_XB_number_es.gif new file mode 100644 index 0000000..6d672ac Binary files /dev/null and b/agc/images/vdc_XB_number_es.gif differ diff --git a/agc/images/vdc_XB_parkcustomerdial.gif b/agc/images/vdc_XB_parkcustomerdial.gif new file mode 100644 index 0000000..195b1a9 Binary files /dev/null and b/agc/images/vdc_XB_parkcustomerdial.gif differ diff --git a/agc/images/vdc_XB_parkcustomerdial_OFF.gif b/agc/images/vdc_XB_parkcustomerdial_OFF.gif new file mode 100644 index 0000000..7c27573 Binary files /dev/null and b/agc/images/vdc_XB_parkcustomerdial_OFF.gif differ diff --git a/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif b/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif new file mode 100644 index 0000000..ef710c9 Binary files /dev/null and b/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif differ diff --git a/agc/images/vdc_XB_parkcustomerdial_es.gif b/agc/images/vdc_XB_parkcustomerdial_es.gif new file mode 100644 index 0000000..accda01 Binary files /dev/null and b/agc/images/vdc_XB_parkcustomerdial_es.gif differ diff --git a/agc/images/vdc_XB_seconds.gif b/agc/images/vdc_XB_seconds.gif new file mode 100644 index 0000000..92fc7f2 Binary files /dev/null and b/agc/images/vdc_XB_seconds.gif differ diff --git a/agc/images/vdc_XB_seconds_es.gif b/agc/images/vdc_XB_seconds_es.gif new file mode 100644 index 0000000..f4fe2b2 Binary files /dev/null and b/agc/images/vdc_XB_seconds_es.gif differ diff --git a/agc/images/vdc_tab_script.gif b/agc/images/vdc_tab_script.gif new file mode 100644 index 0000000..69e43b7 Binary files /dev/null and b/agc/images/vdc_tab_script.gif differ diff --git a/agc/images/vdc_tab_script_es.gif b/agc/images/vdc_tab_script_es.gif new file mode 100644 index 0000000..ba4320d Binary files /dev/null and b/agc/images/vdc_tab_script_es.gif differ diff --git a/agc/images/vdc_tab_vicidial.gif b/agc/images/vdc_tab_vicidial.gif new file mode 100644 index 0000000..1e86258 Binary files /dev/null and b/agc/images/vdc_tab_vicidial.gif differ diff --git a/agc/inbound_popup.php b/agc/inbound_popup.php new file mode 100644 index 0000000..0bf9fcc --- /dev/null +++ b/agc/inbound_popup.php @@ -0,0 +1,337 @@ + LICENSE: GPLv2 +### +### This script is designed to open up when a live_inbound call comes in giving the user +### options of what to do with the call or options to lookup the callerID on various web sites +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $uniqueid - ('1234567890.123456',...) +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $vmail_box - ('101','1234',...) +### - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $voicemail_dump_exten - ('85026666666666') +### - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL) +### + +# changes +# 50428-1500 First build of script display only +# 50429-1241 some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links +# 50503-1244 added session_name checking for extra security +# 50711-1203 removed HTTP authentication in favor of user/pass vars +# + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$vmail_box=$_GET["vmail_box"]; if (!$vmail_box) {$vmail_box=$_POST["vmail_box"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$voicemail_dump_exten=$_GET["voicemail_dump_exten"]; if (!$voicemail_dump_exten) + {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];} +$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"]; if (!$local_web_callerID_URL_enc) + {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];} + $local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc); + +# default optional vars if not set +if (!$format) {$format="text";} + +$version = '0.0.4'; +$build = '50711-1203'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} +$DO = '-1'; +if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc/live_exten_check.php b/agc/live_exten_check.php new file mode 100644 index 0000000..4ff862c --- /dev/null +++ b/agc/live_exten_check.php @@ -0,0 +1,265 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the client channel is live and to what channel it is connected +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +### - $protocol - ('SIP','Zap','IAX2',...) +### + +# changes +# 50404-1249 First build of script +# 50406-1402 added connected trunk lookup +# 50428-1452 added live_inbound check for exten on 2nd line of output +# 50503-1233 added session_name checking for extra security +# 50524-1429 added parked calls count +# 50610-1204 Added NULL check on MySQL results to reduced errors +# 50711-1204 removed HTTP authentication in favor of user/pass vars +# 60103-1541 added favorite extens status display +# + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$favorites_count=$_GET["favorites_count"]; if (!$favorites_count) {$favorites_count=$_POST["favorites_count"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} + +# default optional vars if not set +if (!$format) {$format="text";} + +$version = '1.1.9'; +$build = '60103-1541'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ChannelA[$loop_count] = "$row[0]"; + $ChannelB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChannelA[$counter] ~"; + echo "ChannelB: $ChannelB[$counter] ~"; + echo "ChannelBtrunk: $ChannelA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc/manager_send.php b/agc/manager_send.php new file mode 100644 index 0000000..e6887a2 --- /dev/null +++ b/agc/manager_send.php @@ -0,0 +1,882 @@ + LICENSE: GPLv2 +### +### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial') +### - $queryCID - ('CN012345678901234567',...) +### - $format - ('text','debug') +### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $exten - ('1234','913125551212',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $filename - ('20050406-125623_44444',...) +### - $extenName - ('phone100',...) +### - $parkedby - ('phone100',...) +### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +### - $auto_dial_level - ('0','1','1.1',...) +### - $campaign - ('CLOSER','TESTCAMP',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('1234',...) +### - $seconds - ('32',...) +### - $outbound_cid - ('3125551212','0000000000',...) +### - $agent_log_id - ('123456',...) +### - $call_server_ip - ('10.10.10.15',...) +### - $CalLCID - ('VD01234567890123456',...) +### + +# changes +# 50401-1002 First build of script, Hangup function only +# 50404-1045 Redirect basic function enabled +# 50406-1522 Monitor basic function enabled +# 50407-1647 Monitor and StopMonitor full functions enabled +# 50422-1120 basic Originate function enabled +# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 basic RedirectName and RedirectNameVmail added +# 50503-1227 added session_name checking for extra security +# 50523-1341 added Conference call start/stop recording +# 50523-1421 added OriginateName and OriginateNameVmail for local calls +# 50524-1602 added RedirectToPark and RedirectFromPark +# 50531-1203 added RedirecXtra for dual channel redirection +# 50630-1100 script changed to not use HTTP login vars, user/pass instead +# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 Added outbound_cid set if present to originate call +# 51020-1556 Added agent_log_id framework for detailed agent activity logging +# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 Added ability to accept calls from other VICIDIAL servers +# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### These are variable assignments for PHP globals off +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];} +$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];} +$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];} +$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];} +$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];} +$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];} + +# default optional vars if not set +if (!$ACTION) {$ACTION="Originate";} +if (!$format) {$format="alert";} +if (!$ext_priority) {$ext_priority="1";} + + +$version = '0.0.22'; +$build = '60310-2022'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc/park_calls_display.php b/agc/park_calls_display.php new file mode 100644 index 0000000..7940240 --- /dev/null +++ b/agc/park_calls_display.php @@ -0,0 +1,138 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send the details on the parked calls on the server +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +### - $protocol - ('SIP','Zap','IAX2',...) +### + +# changes +# 50524-1515 First build of script +# 50711-1208 removed HTTP authentication in favor of user/pass vars +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} + +# default optional vars if not set +if (!$format) {$format="text";} +if (!$park_limit) {$park_limit="1000";} + +$version = '0.0.2'; +$build = '50711-1208'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc/vdc_db_query.php b/agc/vdc_db_query.php new file mode 100644 index 0000000..7fbc2fd --- /dev/null +++ b/agc/vdc_db_query.php @@ -0,0 +1,1289 @@ + LICENSE: GPLv2 +### +### This script is designed purely to send whether the meetme conference has live channels connected and which they are +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs') +### - $stage - ('start','finish') +### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +### - $conf_exten - ('8600011',...) +### - $exten - ('123test',...) +### - $ext_context - ('default','demo',...) +### - $ext_priority - ('1','2',...) +### - $campaign - ('testcamp',...) +### - $dial_timeout - ('60','26',...) +### - $dial_prefix - ('9','8',...) +### - $campaign_cid - ('3125551212','0000000000',...) +### - $MDnextCID - ('M06301413000000002',...) +### - $uniqueid - ('1120232758.2406800',...) +### - $lead_id - ('36524',...) +### - $list_id - ('101','123456',...) +### - $length_in_sec - ('12',...) +### - $phone_code - ('1',...) +### - $phone_number - ('3125551212',...) +### - $channel - ('Zap/12-1',...) +### - $start_epoch - ('1120236911',...) +### - $vendor_lead_code - ('1234test',...) +### - $title - ('Mr.',...) +### - $first_name - ('Bob',...) +### - $middle_initial - ('L',...) +### - $last_name - ('Wilson',...) +### - $address1 - ('1324 Main St.',...) +### - $address2 - ('Apt. 12',...) +### - $address3 - ('co Robert Wilson',...) +### - $city - ('Chicago',...) +### - $state - ('IL',...) +### - $province - ('NA',...) +### - $postal_code - ('60054',...) +### - $country_code - ('USA',...) +### - $gender - ('M',...) +### - $date_of_birth - ('1970-01-01',...) +### - $alt_phone - ('3125551213',...) +### - $email - ('bob@bob.com',...) +### - $security_phrase - ('Hello',...) +### - $comments - ('Good Customer',...) +### - $auto_dial_level - ('0','1','1.2',...) +### - $VDstop_rec_after_each_call - ('0','1') +### - $conf_silent_prefix - ('7','8','',...) +### - $extension - ('123','user123','25-1',...) +### - $protocol - ('Zap','SIP','IAX2',...) +### - $user_abb - ('1234','6666',...) +### - $preview - ('YES','NO',...) +### - $called_count - ('0','1','2',...) +### - $agent_log_id - ('123456',...) +### - $agent_log - ('NO',...) +### - $favorites_list - (",'cc160','cc100'",...) +### + +# changes +# 50629-1044 First build of script +# 50630-1422 Added manual dial action and MD channel lookup +# 50701-1451 Added dial log for start and end of vicidial calls +# 50705-1239 Added call disposition update +# 50804-1627 Fixed updateDispo to update vicidial_log entry +# 50816-1605 Added VDADpause/ready for auto dialing +# 50816-1811 Added basic autodial call pickup functions +# 50817-1005 Altered logging functions to accomodate auto_dialing +# 50818-1305 Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 Added hangup of agent phone after Logout +# 50901-1315 Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 Fixed CLOSER log length_in_sec bug +# 50902-1730 Added functions for manual preview dialing and revert +# 50913-1214 Added agent random update to leadupdate +# 51020-1421 Added agent_log_id framework for detailed agent activity logging +# 51021-1717 Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 Altered echo statements for several small PHP speed optimizations +# 51122-1328 Fixed UserLogout issue not removing conference reservation +# 51129-1012 Added ability to accept calls from other VICIDIAL servers +# 51129-1729 Changed manual dial to use the '/n' flag for calls +# 51221-1154 Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 Added Updating of astguiclient favorites in the DB +# 60208-1617 Added dtmf buttons output per call +# 60213-1521 Added closer_campaigns update to vicidial_users +# 60215-1036 Added Callback date-time entry into vicidial_callbacks table +# + +$version = '0.0.26'; +$build = '60215-1036'; + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];} +$stage=$_GET["stage"]; if (!$stage) {$stage=$_POST["stage"];} +$closer_choice=$_GET["closer_choice"]; if (!$closer_choice) {$closer_choice=$_POST["closer_choice"];} +$conf_exten=$_GET["conf_exten"]; if (!$conf_exten) {$conf_exten=$_POST["conf_exten"];} +$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];} +$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];} +$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];} +$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];} +$dial_timeout=$_GET["dial_timeout"]; if (!$dial_timeout) {$dial_timeout=$_POST["dial_timeout"];} +$dial_prefix=$_GET["dial_prefix"]; if (!$dial_prefix) {$dial_prefix=$_POST["dial_prefix"];} +$campaign_cid=$_GET["campaign_cid"]; if (!$campaign_cid) {$campaign_cid=$_POST["campaign_cid"];} +$MDnextCID=$_GET["MDnextCID"]; if (!$MDnextCID) {$MDnextCID=$_POST["MDnextCID"];} +$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];} +$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];} +$list_id=$_GET["list_id"]; if (!$list_id) {$list_id=$_POST["list_id"];} +$length_in_sec=$_GET["length_in_sec"]; if (!$length_in_sec) {$length_in_sec=$_POST["length_in_sec"];} +$phone_code=$_GET["phone_code"]; if (!$phone_code) {$phone_code=$_POST["phone_code"];} +$phone_number=$_GET["phone_number"]; if (!$phone_number) {$phone_number=$_POST["phone_number"];} +$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} +$start_epoch=$_GET["start_epoch"]; if (!$start_epoch) {$start_epoch=$_POST["start_epoch"];} +$dispo_choice=$_GET["dispo_choice"]; if (!$dispo_choice) {$dispo_choice=$_POST["dispo_choice"];} +$vendor_lead_code=$_GET["vendor_lead_code"]; if (!$vendor_lead_code) {$vendor_lead_code=$_POST["vendor_lead_code"];} +$title=$_GET["title"]; if (!$title) {$title=$_POST["title"];} +$first_name=$_GET["first_name"]; if (!$first_name) {$first_name=$_POST["first_name"];} +$middle_initial=$_GET["middle_initial"]; if (!$middle_initial) {$middle_initial=$_POST["middle_initial"];} +$last_name=$_GET["last_name"]; if (!$last_name) {$last_name=$_POST["last_name"];} +$address1=$_GET["address1"]; if (!$address1) {$address1=$_POST["address1"];} +$address2=$_GET["address2"]; if (!$address2) {$address2=$_POST["address2"];} +$address3=$_GET["address3"]; if (!$address3) {$address3=$_POST["address3"];} +$city=$_GET["city"]; if (!$city) {$city=$_POST["city"];} +$state=$_GET["state"]; if (!$state) {$state=$_POST["state"];} +$province=$_GET["province"]; if (!$province) {$province=$_POST["province"];} +$postal_code=$_GET["postal_code"]; if (!$postal_code) {$postal_code=$_POST["postal_code"];} +$country_code=$_GET["country_code"]; if (!$country_code) {$country_code=$_POST["country_code"];} +$gender=$_GET["gender"]; if (!$gender) {$gender=$_POST["gender"];} +$date_of_birth=$_GET["date_of_birth"]; if (!$date_of_birth) {$date_of_birth=$_POST["date_of_birth"];} +$alt_phone=$_GET["alt_phone"]; if (!$alt_phone) {$alt_phone=$_POST["alt_phone"];} +$email=$_GET["email"]; if (!$email) {$email=$_POST["email"];} +$security_phrase=$_GET["security_phrase"]; if (!$security_phrase) {$security_phrase=$_POST["security_phrase"];} +$comments=$_GET["comments"]; if (!$comments) {$comments=$_POST["comments"];} +$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];} +$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"]; if (!$VDstop_rec_after_each_call) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +$conf_silent_prefix=$_GET["conf_silent_prefix"]; if (!$conf_silent_prefix) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +$extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} +$protocol=$_GET["protocol"]; if (!$protocol) {$protocol=$_POST["protocol"];} +$user_abb=$_GET["user_abb"]; if (!$user_abb) {$user_abb=$_POST["user_abb"];} +$preview=$_GET["preview"]; if (!$preview) {$preview=$_POST["preview"];} +$called_count=$_GET["called_count"]; if (!$called_count) {$called_count=$_POST["called_count"];} +$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];} +$agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"];} +$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];} +$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];} + + +# default optional vars if not set +if (!$format) {$format="text";} +if ($format == 'debug') {$DB=1;} +if (!$ACTION) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +if (!$query_date) {$query_date = $NOW_DATE;} +$MT[0]=''; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +{ +echo "Invalid Username/Password: |$user|$pass|\n"; +exit; +} +else +{ + +if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } +else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Local_out_prefix$phone_code$phone_number','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (eregi("CLOSER",$campaign)) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if (strlen($VDCL_group_web)>5) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='$vendor_lead_code', title='$title', first_name='$first_name', middle_initial='$middle_initial', last_name='$last_name', address1='$address1', address2='$address2', address3='$address3', city='$city', state='$state', province='$province', postal_code='$postal_code', country_code='$country_code', gender='$gender', date_of_birth='$date_of_birth', alt_phone='$alt_phone', email='$email', security_phrase='$security_phrase', comments='$comments' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc/vicidial.php b/agc/vicidial.php new file mode 100644 index 0000000..afafb6e --- /dev/null +++ b/agc/vicidial.php @@ -0,0 +1,4633 @@ + LICENSE: GPLv2 +### +### make sure you have added a user to the vicidial_users MySQL table with at least +### user_level 1 or greater to access this page. Also, you need to have the login +### and pass of a phone listed in the asterisk.phones table. The page grabs the +### server info and other details from this login and pass. +### +### This script works best with Firefox or Mozilla, but will run for a couple +### hours on Internet Explorer before the memory leaks cause a crash. +### +### Other scripts that this application depends on: +### - vdc_db_query.php: Updates information in the database +### - manager_send.php: Sends manager actions to the DB for execution +### +### CHANGES +### 50607-1426 - First Build of VICIDIAL web client basic login process finished +### 50628-1620 - Added some basic formatting and worked on process flow +### 50628-1715 - Startup variables mapped to javascript variables +### 50629-1303 - Added Login Closer in-groups selection box and vla update +### 50629-1530 - Rough layout for customer info form section and button links +### 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +### 50701-1450 - Added vicidial_log entries on dial and hangup +### 50701-1634 - Added Logout function +### 50705-1259 - Added call disposition functionality +### 50705-1432 - Added lead info DB update function +### 50705-1658 - Added web form functionality +### 50706-1043 - Added call park and pickup functions +### 50706-1234 - Added Start/Stop Recording functionality +### 50706-1614 - Added conference channels display option +### 50711-1333 - Removed call check redundancy and fixed a span bug +### 50727-1424 - Added customer channel and participant present sensing/alerts +### 50804-1057 - Added SendDTMF function and reconfigured the transfer span +### 50804-1224 - Added Local and Internal Closer transfer functions +### 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +### 50804-1808 - Added button images for left buttons +### 50815-1151 - Added 3Way calling functions to Transfer-conf frame +### 50815-1602 - Added images and buttons for xfer functions +### 50816-1813 - Added basic autodial outbound call pickup functions +### 50817-1113 - Fixes to auto_dialing call receipt +### 50817-1234 - Added inbound call receipt capability +### 50817-1541 - Added customer time display +### 50817-1541 - Added customer time display +### 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +### 50818-1703 - Added pretty login section +### 50825-1200 - Modified form field lengths, added double-click dispositions +### 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +### 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +### 50903-0904 - Added preview-lead code for manual dialing +### 50904-0016 - Added ability to hangup manual dials before pickup +### 50906-1319 - Added override for filters on xfer calls, fixed login display bug +### 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +### 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +### 50913-1212 - Added campaign_cid to 3rd party calls +### 50923-1546 - Modified to work with language translation +### 50926-1656 - Added campaign pull-down at login of active campaigns +### 50928-1633 - Added manual dial alternate number dial option +### 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +### 51004-1656 - Fixed recording filename bug and new Spanish translation +### 51020-1103 - Added campaign-specific recording control abilities +### 51020-1352 - Added Basic vicidial_agent_log framework +### 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +### 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +### 51110-1432 - Fixed non-standard http port issue +### 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +### 51118-1305 - Activate multi-line comments from $multi_line_comments var +### 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +### 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +### 51129-1010 - Added ability to accept calls from other VICIDIAL servers +### 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +### 51208-1732 - Created user-first login that looks for default phone info +### 51219-1526 - Added variable framework for campaign and in-group scripts +### 51221-1200 - Added SCRIPT tab, layout and functionality +### 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +### 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +### 51229-1028 - Added checks on web_form_address to allow for var in the DB value +### 60117-1312 - Added Transfer-conf frame toggle on button press +### 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +### 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +### 60213-1210 - Added ability to sort routing of calls by user_level +### 60214-0932 - Initial Callback calendar display framework +### 60214-1407 - Added ability to minimize the dispo screen to see info below +### 60215-1104 - Added ANYONE scheduled callbacks functionality +### + +require("dbconnect.php"); + +$DB=$_GET['DB']; if (!$DB) {$DB=$_POST["DB"];} +$phone_login=$_GET['phone_login']; if (!$phone_login) {$phone_login=$_POST["phone_login"];} + if (!$phone_login) {$phone_login=$_GET["pl"];} +$phone_pass=$_GET['phone_pass']; if (!$phone_pass) {$phone_pass=$_POST["phone_pass"];} + if (!$phone_pass) {$phone_pass=$_GET["pp"];} +$VD_login=$_GET['VD_login']; if (!$VD_login) {$VD_login=$_POST["VD_login"];} +$VD_pass=$_GET['VD_pass']; if (!$VD_pass) {$VD_pass=$_POST["VD_pass"];} +$VD_campaign=$_GET['VD_campaign']; if (!$VD_campaign) {$VD_campaign=$_POST["VD_campaign"];} + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); +$relogin=$_GET['relogin']; if (!$relogin) {$relogin=$_POST["relogin"];} + +$forever_stop=0; + +$version = '1.1.66'; +$build = '60215-1104'; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$manual_dial_preview = '1'; # Allow preview lead option when manual dial +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_alt_phone = '1'; # allow manual dial users to call alt phone number +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$US='_'; +$CL=':'; +$AT='@'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; +$agcDIR = eregi_replace('vicidial.php','',$agcPAGE); + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + + +if ($relogin == 'YES') +{ +echo "VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$fp = fopen ("./vicidial_auth_entries.txt", "a"); +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' order by group_id limit 20;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(0,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + + + +\n"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICIDIALSCRIPT   LIVE     session ID: Live Call
+
+ + + + +

VICIDIAL
+
+ + + + +
+ + Transfer - Conference
+ INTERNAL CLOSER + LOCAL CLOSER + CODE + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + seconds   + channel + + OVERRIDE   + D1 + D2 +
+ + Dial With Customer + Park Customer Dial + LEAVE 3-WAY CALL + Dial Blind Transfer + Blind Transfer VMail Message +
+
+
+ + + + +
Lead Dispositioned As:

+ -
+
+
+ + + + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + +
Noone is in your session:
+ OK +
+
+ + +
Customer has hung up:
+ OK +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + +
DISPOSITION CALL :       minimize
+ End-of-call Disposition Selection +
+ STOP CALLING
+ RESET | + SUBMIT +



  +
+
+ + + +
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ + CB Comments:

+ + SUBMIT

+ + +

  +
+
+ + +
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + + + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ REFRESH


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + +
VICIDIAL SCRIPT
+
+ + + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
";} +if ( ($manual_dial_alt_phone) and ($auto_dial_level==0) ) + {echo " ALT PHONE DIAL
";} + + +?> +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+Send DTMF
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments:
+ +
+


  + +
+ + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/agc/voicemail_check.php b/agc/voicemail_check.php new file mode 100644 index 0000000..12d1735 --- /dev/null +++ b/agc/voicemail_check.php @@ -0,0 +1,132 @@ + LICENSE: GPLv2 +### +### This script is designed purely to check whether the voicemail box on the server defined has new and old messages +### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +### +### required variables: +### - $server_ip +### - $session_name +### - $user +### - $pass +### optional variables: +### - $format - ('text','debug') +### - $vmail_box - ('101','1234',...) +### + +# changes +# 50422-1147 First build of script +# 50503-1241 added session_name checking for extra security +# 50711-1201 removed HTTP authentication in favor of user/pass vars +# + + +require("dbconnect.php"); + +#require_once("htglobalize.php"); + +### If you have globals turned off uncomment these lines +$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} +$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];} +$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} +$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];} +$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];} +$vmail_box=$_GET["vmail_box"]; if (!$vmail_box) {$vmail_box=$_POST["vmail_box"];} + +# default optional vars if not set +if (!$format) {$format="text";} + +$version = '0.0.3'; +$build = '50711-1201'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!$query_date) {$query_date = $NOW_DATE;} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if(!$SNauth) + { + echo "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agi-CIDtest.agi b/agi-CIDtest.agi new file mode 100644 index 0000000..1818661 --- /dev/null +++ b/agi-CIDtest.agi @@ -0,0 +1,175 @@ +#!/usr/bin/perl +# +# agi-CIDtest.agi +# +# this script is designed to do testing of CallerID strings and how flexible Asterisk is to assigning just CIDnum and CIDname +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8367,1,AGI(agi-CIDtest.agi,${EXTEN}) +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V=1; +$M=1; + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } + + +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|\n";} + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDAD_LB_closer.agi b/agi-VDAD_LB_closer.agi new file mode 100644 index 0000000..d6d919d --- /dev/null +++ b/agi-VDAD_LB_closer.agi @@ -0,0 +1,525 @@ +#!/usr/bin/perl +# +# agi-VDAD_LB_transfer.agi version 0.1 +# Load Balanced - when a call comes in on this server the script looks for an agent +# on any server on the network on the same campaign to send call to. +# +# runs when a call comes in from a VICIDIAL fronter. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will send the call to the specified Vmail +# box or hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound VICIDIAL calls: +#exten => _90009.,1,Answer ; Answer the line +#exten => _90009.,2,AGI(agi-VDADcloser.agi,${EXTEN}-----START) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + ### allow for internal PRI transfer data string "90009*CL_uk3survy_*8301*10000123*universal***" + if ($extension =~ /^900\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $channel_group = $EXT_vars[1]; # name of the parked group + $inbound_number = $EXT_vars[2]; # extension to send call to after parsing + $parked_by = $EXT_vars[3]; # leadID + $park_extension = $EXT_vars[4]; # filename of the on-hold music file + $comment_d = $EXT_vars[5]; # N/A + $comment_e = $EXT_vars[6]; # N/A + + $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # JmmddhhmmssLLLLLLLLL + $JqueryCID = "J$CIDdate$PADlead_id"; + $callerid = $JqueryCID; + ### set the callerid to the filename of the audio for on-hold + print "SET CALLERID $JqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $JqueryCID\n"; + } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel\n";} +if ($M) {print STDERR "+++++ VDCL START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + +$stmtA = "SELECT phone_number,phone_code,user FROM vicidial_list where lead_id='$CIDlead_id' limit 1;"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$channel_group"; + $VDADphone = "$record->[0]"; + $VDADphone_code = "$record->[1]"; + $VDADlead_id = "$CIDlead_id"; + $VDADfronter = "$record->[2]"; + } + } + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$CIDlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$SQLdate')"; +$dbhA->query($stmtA); + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$CIDlead_id','$VDADcampaign','$SQLdate','$VDADphone_code','$VDADphone','$VDADfronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$server_ip' where status IN('CLOSER','READY') and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $VDADcampaign %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + $VDADremDIALstr=''; + if( ($VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/) && ($VDADserver_ip !~ /$server_ip/) ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADremDIALstr\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$CIDlead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. diff --git a/agi-VDAD_LB_closer_inbound.agi b/agi-VDAD_LB_closer_inbound.agi new file mode 100644 index 0000000..3b4ba87 --- /dev/null +++ b/agi-VDAD_LB_closer_inbound.agi @@ -0,0 +1,649 @@ +#!/usr/bin/perl +# +# agi-VDAD_LB_closer_inbound.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# ## THIS IS THE LOAD-BALANCED VERSION OF THE SCRIPT ## +# +# if there are no available agents on any server, it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# This version asks for a 4-digit pin number to be entered and passed on as the fronter value to the closer +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDAD_LO_closer_inbound.agi,CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + $phone_number=''; + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +&enter_pin_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$new_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$server_ip' where status IN('CLOSER','READY') and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( ($VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/) && ($VDADserver_ip !~ /$server_ip/) ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD REMOTE XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent \ No newline at end of file diff --git a/agi-VDAD_LB_transfer.agi b/agi-VDAD_LB_transfer.agi new file mode 100644 index 0000000..91195b9 --- /dev/null +++ b/agi-VDAD_LB_transfer.agi @@ -0,0 +1,505 @@ +#!/usr/bin/perl +# +# agi-VDAD_LB_transfer.agi version 0.2 +# Load Balanced - when a call comes in on this server the script looks for an agent +# on any server on the network on the same campaign to send call to. +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped. +# +# this version "LO" Load Overflow checks first with local agents then it will seek out agents on the +# same campaign on other servers and transfer the calls to them over IAX trunks. +# the IAX user trunks are named based on the IP address of the home server: +# The server 10.10.10.15 would have a username of 10x10x10x15 in the iax.conf on the other servers +# Also, the home server needs to have the trunks registered, for speed and channel consistency +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 51118-2102 first build based on agi-VDADtransfer.agi script +# 60119-1408 fixed calleridname issue with 1.2 tree for custom CID +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 10; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VDAD START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|\n";} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$record->[0]"; + $VDADphone = "$record->[1]"; + $VDADphone_code = "$record->[2]"; + $VDADlead_id = "$record->[3]"; + $VDADcall_time = "$record->[4]"; + } + } + + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } +if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$server_ip', callerid='$callerid' where status = 'READY' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + $VDADremDIALstr=''; + if( ($VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/) && ($VDADserver_ip !~ /$server_ip/) ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADremDIALstr\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } +else + { + print STDERR "WWWWWWWW VDAD XFER REMOTE WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|\n"; + } + + +### sleep for 99 hundredths of a second +usleep(1*990*1000); + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### use manager middleware-app to connect the next call to the meetme room + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. diff --git a/agi-VDAD_LO_closer.agi b/agi-VDAD_LO_closer.agi new file mode 100644 index 0000000..35dd847 --- /dev/null +++ b/agi-VDAD_LO_closer.agi @@ -0,0 +1,610 @@ +#!/usr/bin/perl +# +# agi-VDAD_LO_closer.agi version 0.1 +# Overflow Balanced - when a call comes in on this server the script looks for an agent +# on this server to send call to. If none available it looks for the next available +# agent on any other server on the network on the same campaign to send call to. +# +# runs when a call comes in from a VICIDIAL fronter. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will send the call to the specified Vmail +# box or hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound VICIDIAL calls: +#exten => _90009.,1,Answer ; Answer the line +#exten => _90009.,2,AGI(agi-VDADcloser.agi,${EXTEN}-----START) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + ### allow for internal PRI transfer data string "90009*CL_uk3survy_*8301*10000123*universal***" + if ($extension =~ /^900\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $channel_group = $EXT_vars[1]; # name of the parked group + $inbound_number = $EXT_vars[2]; # extension to send call to after parsing + $parked_by = $EXT_vars[3]; # leadID + $park_extension = $EXT_vars[4]; # filename of the on-hold music file + $comment_d = $EXT_vars[5]; # N/A + $comment_e = $EXT_vars[6]; # N/A + + $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # JmmddhhmmssLLLLLLLLL + $JqueryCID = "J$CIDdate$PADlead_id"; + $callerid = $JqueryCID; + ### set the callerid to the filename of the audio for on-hold + print "SET CALLERID $JqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $JqueryCID\n"; + } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel\n";} +if ($M) {print STDERR "+++++ VDCL START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + +$stmtA = "SELECT phone_number,phone_code,user FROM vicidial_list where lead_id='$CIDlead_id' limit 1;"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$channel_group"; + $VDADphone = "$record->[0]"; + $VDADphone_code = "$record->[1]"; + $VDADlead_id = "$CIDlead_id"; + $VDADfronter = "$record->[2]"; + } + } + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$CIDlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$SQLdate')"; +$dbhA->query($stmtA); + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$CIDlead_id','$VDADcampaign','$SQLdate','$VDADphone_code','$VDADphone','$VDADfronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $VDADcampaign %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + +################################################################################################### +### noone found locally available, now check for someone on another server to take the call + + $rec_countWAITrem=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip!='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAITrem < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$server_ip' where status IN('CLOSER','READY') and server_ip!='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $VDADcampaign %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and server_ip!='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADremDIALstr\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER REMOTE WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + + + + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$CIDlead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. diff --git a/agi-VDAD_LO_closer_inbound.agi b/agi-VDAD_LO_closer_inbound.agi new file mode 100644 index 0000000..8a0a012 --- /dev/null +++ b/agi-VDAD_LO_closer_inbound.agi @@ -0,0 +1,739 @@ +#!/usr/bin/perl +# +# agi-VDAD_LO_closer_inbound.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# ## THIS IS THE LOAD-BALANCED-OVERFLOW VERSION OF THE SCRIPT ## +# +# if there are no available agents on this server, it will check for available agents on other servers, +# then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# This version asks for a 4-digit pin number to be entered and passed on as the fronter value to the closer +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDAD_LO_closer_inbound.agi,CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + $phone_number=''; + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +&enter_pin_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$new_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + +################################################################################################### +### noone found locally available, now check for someone on another server to take the call + + $rec_countWAITrem=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip!='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAITrem = "$record->[0]"; + } + } + if ($rec_countWAITrem < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$server_ip' where status IN('CLOSER','READY') and server_ip!='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and server_ip!='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD REMOTE XFER WAIT: |$rec_countWAITrem|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent \ No newline at end of file diff --git a/agi-VDAD_LO_transfer.agi b/agi-VDAD_LO_transfer.agi new file mode 100644 index 0000000..db218ec --- /dev/null +++ b/agi-VDAD_LO_transfer.agi @@ -0,0 +1,579 @@ +#!/usr/bin/perl +# +# agi-VDAD_LO_transfer.agi version 0.2 +# Overflow Balanced - when a call comes in on this server the script looks for an agent +# on this server to send call to. If none available it looks for the next available +# agent on any other server on the network on the same campaign to send call to. +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped. +# +# this version "LO" Load Overflow checks first with local agents then it will seek out agents on the +# same campaign on other servers and transfer the calls to them over IAX trunks. +# the IAX user trunks are named based on the IP address of the home server: +# The server 10.10.10.15 would have a username of 10x10x10x15 in the iax.conf on the other servers +# Also, the home server needs to have the trunks registered, for speed and channel consistency +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 51118-2102 first build based on agi-VDADtransfer.agi script +# 60119-1408 fixed calleridname issue with 1.2 tree for custom CID +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 10; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VDAD START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|\n";} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$record->[0]"; + $VDADphone = "$record->[1]"; + $VDADphone_code = "$record->[2]"; + $VDADlead_id = "$record->[3]"; + $VDADcall_time = "$record->[4]"; + } + } + + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } +if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$server_ip', callerid='$callerid' where status = 'READY' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } +else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|\n"; + } + +################################################################################################### +### noone found locally available, now check for someone on another server to take the call + + $rec_countWAITrem=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip!='$server_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; +if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAITrem = "$record->[0]"; + } + } +if ($rec_countWAITrem < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$server_ip', callerid='$callerid' where status = 'READY' and server_ip!='$server_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and server_ip!='$server_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + $VDADserver_ip = "$record->[3]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $dbhA->close; + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADremDIALstr\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } +else + { + print STDERR "WWWWWWWW VDAD XFER REMOTE WAIT: |$rec_countWAITrem|$VDADcampaign|$channel|$callerid|$uniqueid|\n"; + } + + +### sleep for 99 hundredths of a second +usleep(1*990*1000); + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### use manager middleware-app to connect the next call to the meetme room + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. diff --git a/agi-VDADautoREMINDER.agi b/agi-VDADautoREMINDER.agi new file mode 100644 index 0000000..728b427 --- /dev/null +++ b/agi-VDADautoREMINDER.agi @@ -0,0 +1,610 @@ +#!/usr/bin/perl +# +# agi-VDADautoREMINDER.agi version 0.2 +# +# runs when a call comes in from the VICIDIAL auto_dialer. This script will +# send the calls out to specified voicemail boxes in if called person presses key. +# The voicemail box is defined per-lead in the vicidial_list.security_phrase field +# This campaign does not send calls to live agents. +# +# Call statuses from this script: +# N- Call was picked up, didn't finish initial message +# MP- Initial message was played +# VM- call was sent to voicemail +# CALLBK- customer selected to be called back +# +# It is recommended that you run this campaign at a dial level of 1.0 +# It is recommended that you use remote_agents for activation of this script +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8372,1,AGI(call_log.agi,${EXTEN}) +# exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60313-1626 - First build +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +##### AUDIO FILES IN THIS PROGRAM ##### +$message_audio_file = 'US_reminder_message'; +$options_audio_file = 'US_reminder_options'; +# $voicemail_xfer_file = 'US_reminder_voicemail'; not used +$callback_audio_file = 'US_reminder_callback'; +$goodbye_audio_file = 'US_reminder_goodbye'; + + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; #20060310100402 + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VDAD START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$priority|\n";} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + + +sleep(1); + +$AGI->stream_file('beep'); + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +######### INSERT/UPDATE CALL RECORD ########## +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$record->[0]"; + $VDADphone = "$record->[1]"; + $VDADphone_code = "$record->[2]"; + $VDADlead_id = "$record->[3]"; + $VDADcall_time = "$record->[4]"; + } + } + + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','N','$VDADphone_code','$VDADphone','VDAD','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + + } + + + + +######### REMINDER CHOICE FROM RECORDINGS ######## +&reminder_choice; + +if ($pin < 1) + { + &reminder_choice; + + if ($pin < 1) + { + $AGI->stream_file("$goodbye_audio_file"); + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + + $stmtA = "UPDATE vicidial_log set end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip|$end_date_epoch|$now_date_epoch|$length_in_sec|\n";} + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + + sleep(1); + + exit; + } + } + +if ($V) {print STDERR "+++++ VDAD STATUS : pressed $pin|$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($pin !~ /^1|^2/) {exit;} + +if (!$DB_port) {$DB_port='3306';} + + + + + +if ($pin =~ /^1|^2/) +{ + +if ($pin == "1") ### send call to voicemail + { +# message can be left on agent vmail box +# # Thank you for your response, we will now transfer you to your agent's voicemail box. +# $AGI->stream_file("$voicemail_xfer_file"); + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_list set status='VM' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER\n";} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + $stmtA = "UPDATE vicidial_log set status='VM', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record updated: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $VMAIL_box=0; + ### Grab Server values from the database + $stmtA = "SELECT security_phrase FROM vicidial_list where lead_id = '$CIDlead_id';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $VMAIL_box = "$record->[0]"; + } + } + + ### SEND CALL TO VOICEMAIL BOX ### + print STDERR "\nexiting the VDAD app, transferring call to $voicemail_dump_exten$VMAIL_box\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VMAIL_box\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + + } + +if ($pin == "2") ### mark call as a CALLBK + { + + # Thank you for your response, your agent will be contacting you shortly. + $stmtA = "DELETE from vicidial_auto_calls where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD DONE : |$affected_rows|delete of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_list set status='CALLBK' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER\n";} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + $stmtA = "UPDATE vicidial_log set status='CALLBK', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record updated: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $AGI->stream_file("$callback_audio_file"); + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + + sleep(1); + + exit; + } + +} ### end if pressed 1,2 + + + + + +else ### user pressed digit other than 1 or 2 +{ + +exit; +} + +$dbhA->close; + + + +exit; + + + + + + + + + + + +sub reminder_choice +{ +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +# Hello, this is a courtesy call from ACME Industries reminding you that the deadline for the submission of orders for the June 5th batch delivery is tomorrow, March 10th: + # second audio file +# If you would like to leave a message for your agent please press 1. +# If you would like to have your agent call you back please press 2. + # third audio file +# Thank you, Goodbye + + +######### PLAY THE MESSAGE FILE THEN WAIT 2 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$message_audio_file",'12'); + print STDERR "interrupt_digit |$interrupt_digit|\n"; +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +$channel_status = $AGI->channel_status("$channel"); + if ($V) {print STDERR "SSSSSSSSSS Channel Status: $channel_status\n";} + + if ($channel_status == 6) + { + $stmtA = "UPDATE vicidial_log set status='MP' where uniqueid = '$uniqueid' and lead_id='$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: N|$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_list set status='MP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: N|$affected_rows|$CIDlead_id\n";} + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000')); # wait 2 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; + return; + } + + + +######### PLAY THE OPTIONS FILE THEN WAIT 5 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$options_audio_file",'12'); + print STDERR "interrupt_digit |$interrupt_digit|\n"; +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; + return; + } +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + diff --git a/agi-VDADcloser.agi b/agi-VDADcloser.agi new file mode 100644 index 0000000..2038db7 --- /dev/null +++ b/agi-VDADcloser.agi @@ -0,0 +1,500 @@ +#!/usr/bin/perl +# +# agi-VDADcloser.agi version 0.2 +# +# runs when a call comes in from a VICIDIAL fronter. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will send the call to the specified Vmail +# box or hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound VICIDIAL calls: +#exten => _90009.,1,Answer ; Answer the line +#exten => _90009.,2,AGI(agi-VDADcloser.agi,${EXTEN}-----START) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + ### allow for internal PRI transfer data string "90009*CL_uk3survy_*8301*10000123*universal***" + if ($extension =~ /^900\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $channel_group = $EXT_vars[1]; # name of the parked group + $inbound_number = $EXT_vars[2]; # extension to send call to after parsing + $parked_by = $EXT_vars[3]; # leadID + $park_extension = $EXT_vars[4]; # filename of the on-hold music file + $comment_d = $EXT_vars[5]; # N/A + $comment_e = $EXT_vars[6]; # N/A + + $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # JmmddhhmmssLLLLLLLLL + $JqueryCID = "J$CIDdate$PADlead_id"; + $callerid = $JqueryCID; + ### set the callerid to the filename of the audio for on-hold + print "SET CALLERID $JqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $JqueryCID\n"; + } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel\n";} +if ($M) {print STDERR "+++++ VDCL START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + +$stmtA = "SELECT phone_number,phone_code,user FROM vicidial_list where lead_id='$CIDlead_id' limit 1;"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$channel_group"; + $VDADphone = "$record->[0]"; + $VDADphone_code = "$record->[1]"; + $VDADlead_id = "$CIDlead_id"; + $VDADfronter = "$record->[2]"; + } + } + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$CIDlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$SQLdate')"; +$dbhA->query($stmtA); + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$CIDlead_id','$VDADcampaign','$SQLdate','$VDADphone_code','$VDADphone','$VDADfronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $VDADcampaign %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$CIDlead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADcloser_PHONE.agi b/agi-VDADcloser_PHONE.agi new file mode 100644 index 0000000..309ddcd --- /dev/null +++ b/agi-VDADcloser_PHONE.agi @@ -0,0 +1,535 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_PHONE.agi version 0.2 +# +# runs when a call comes in from a VICIDIAL fronter from a foreign location. This script will +# send the calls out to the closers that are logged in. Customer data is not supplied aside from phone number, +# because the data resides on the foreign system. It is recommended that the WEB FORM page used for this would +# lookup the customer info from the foreign server as an alternate to doing the lookup in this script +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped or +# if voicemail is defined, the call will go to voicemail +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound VICIDIAL calls: +#exten => _90009.,1,Answer ; Answer the line +#exten => _90009.,2,AGI(agi-VDADcloser_PHONE.agi,${EXTEN}-----START) +# +# +#AGI Environment Dump: +# -- accountcode = +# -- callerid = unknown +# -- channel = Zap/26-1 +# -- context = default +# -- dnid = 90009*CL_MWCOF_L**2470995**7275551212*12345* +# -- enhanced = 0.0 +# -- extension = 90009*CL_MWCOF_L**2470995**7275551212*12345* +# -- language = en +# -- priority = 4 +# -- rdnis = unknown +# -- request = agi-VDADcloser_PHONE.agi +# -- type = Zap +# -- uniqueid = 1110912481.2331 +#AGI Environment Dump: |1110912481.2331|Zap/26-1|90009*CL_MWCOF_L**2470995**7275551212*12345*|Zap|J0315134801002470995| +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + ### allow for internal PRI transfer data string "90009*CL_uk3survy_*8301*10000123*universal***" + ### 90009*CL_MWCOF_L**2470995**7275551212*12345* + if ($extension =~ /^900\d\d\*|^8900\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $channel_group = $EXT_vars[1]; # name of the parked group + $inbound_number = $EXT_vars[2]; # extension to send call to after parsing + $parked_by = $EXT_vars[3]; # leadID + $park_extension = $EXT_vars[4]; # filename of the on-hold music file + $cust_phone = $EXT_vars[5]; # customer phone number + $ref_agent = $EXT_vars[6]; # referral agent ID + + # $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # # JmmddhhmmssLLLLLLLLL + # $JqueryCID = "J$CIDdate$PADlead_id"; + # $callerid = $JqueryCID; + # ### set the callerid to the filename of the audio for on-hold + # print "SET CALLERID $JqueryCID\n"; + # checkresult($result); + # print STDERR "callerID changed: $JqueryCID\n"; + } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel\n";} +if ($M) {print STDERR "+++++ VDCL START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} +if (!$list_id) {$list_id = '999';} +if (!$phone_code) {$phone_code = '1';} +if (!$VLcomments) {$VLcomments = '';} +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBOUND','$ref_agent','$parked_by','VDCL','$list_id','Y','$phone_code','$cust_phone','$channel_group','1','-5.00','$VLcomments');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +$CIDlead_id = $new_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + + $VDADcampaign = "$channel_group"; + $VDADphone = "$cust_phone"; + $VDADphone_code = "$phone_code"; + $VDADlead_id = "$new_lead_id"; + $VDADfronter = "$ref_agent"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$CIDlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$SQLdate')"; +$dbhA->query($stmtA); + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$CIDlead_id','$VDADcampaign','$SQLdate','$VDADphone_code','$VDADphone','$VDADfronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$VDADlead_id|$CIDlead_id|insert to vicidial_closer_log\n";} + + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $VDADcampaign %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$CIDlead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADcloser_inbound.agi b/agi-VDADcloser_inbound.agi new file mode 100644 index 0000000..ea577b0 --- /dev/null +++ b/agi-VDADcloser_inbound.agi @@ -0,0 +1,633 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inbound.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# This version asks for a 4-digit pin number to be entered and passed on as the fronter value to the closer +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDADcloser_inbound.agi,CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + $phone_number=''; + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +&enter_pin_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$new_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent \ No newline at end of file diff --git a/agi-VDADcloser_inboundANI.agi b/agi-VDADcloser_inboundANI.agi new file mode 100644 index 0000000..4c35db0 --- /dev/null +++ b/agi-VDADcloser_inboundANI.agi @@ -0,0 +1,610 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inboundANI.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# *** This version detects inbound callerID over robbed-bit T1 ANI delivery *** +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDADcloser_inboundANI.agi,CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + +# if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) +# { +# $calleridname = $callerid; +# $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; +# $calleridname =~ s/\"|\" //gi; +# } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; +# if ( (!$callerid) or ($callerid =~ /unknown/) ) +# {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + + ### allow for external callerid to be collected from ANI *NXXNXXXXXX*DNIS + if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $phone_number = $EXT_vars[1]; # ANI phone number + $DNIS = $EXT_vars[2]; # name of the parked group + } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +#&enter_pin_number; + +$pin = $inbound_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00','$VLcomments');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$new_lead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADcloser_inboundCID.agi b/agi-VDADcloser_inboundCID.agi new file mode 100644 index 0000000..ae0ec3c --- /dev/null +++ b/agi-VDADcloser_inboundCID.agi @@ -0,0 +1,626 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inboundCID.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# *** This version detects inbound callerID over PRI *** +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Ringing ; call ringing +#exten => 1234,2,Wait(1) ; Wait 1 second for CID delivery from PRI +#exten => 1234,3,Answer ; Answer the line +#exten => 1234,4,AGI(agi-VDADcloser_inboundCID.agi,CL_GALLERIA-----7275555134-----Closer-----park----------999-----1) +#exten => 1234,5,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + + if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +#&enter_pin_number; + +$pin = $inbound_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00','$VLcomments');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$new_lead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADcloser_inboundCIDlookup.agi b/agi-VDADcloser_inboundCIDlookup.agi new file mode 100644 index 0000000..3b61930 --- /dev/null +++ b/agi-VDADcloser_inboundCIDlookup.agi @@ -0,0 +1,639 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inboundCID.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# *** This version detects inbound callerID over PRI *** +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Ringing ; call ringing +#exten => 1234,2,Wait(1) ; Wait 1 second for CID delivery from PRI +#exten => 1234,3,Answer ; Answer the line +#exten => 1234,4,AGI(agi-VDADcloser_inboundCID.agi,CL_GALLERIA-----7275555134-----Closer-----park----------999-----1) +#exten => 1234,5,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + + if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +#&enter_pin_number; + +$pin = $inbound_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +$stmtA= "SELECT lead_id from vicidial_list where list_id='$list_id' and phone_number='$phone_number' order by modify_date limit 1;" +$dbhA->query($stmtA); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $insert_lead_id = "$record->[0]"; + } + } else { + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00','$VLcomments');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +} +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + +# $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; +# if($M){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); +# if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$new_lead_id|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADcloser_inbound_5ID.agi b/agi-VDADcloser_inbound_5ID.agi new file mode 100644 index 0000000..00c16d0 --- /dev/null +++ b/agi-VDADcloser_inbound_5ID.agi @@ -0,0 +1,633 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inbound.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# This version asks for a 5-digit pin number to be entered and passed on as the fronter value to the closer +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDADcloser_inbound.agi,CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + $phone_number=''; + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +&enter_pin_number; + +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$new_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } + +while ( ($digit_loop_counter < 5) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent \ No newline at end of file diff --git a/agi-VDADcloser_inbound_NOCID.agi b/agi-VDADcloser_inbound_NOCID.agi new file mode 100644 index 0000000..b305b1e --- /dev/null +++ b/agi-VDADcloser_inbound_NOCID.agi @@ -0,0 +1,560 @@ +#!/usr/bin/perl +# +# agi-VDADcloser_inbound_NOCID.agi version 0.2 +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# This version asks for nothing and assumes no CID is being sent +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; 1. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 2. the phone number that was called, for the log entry +# ; 3. the callerID or lead_id of the person that called(usually overridden) +# ; 4. the park extension audio file name if used +# ; 5. the status of the call initially(usually not used) +# ; 6. the list_id to insert the new lead under if it is new (and callerID available) +# ; 7. the phone dialing code to insert with the new lead if new (and callerID available) +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDADcloser_inbound_NOCID.agi,CL_GALLERIA-----7275555134-----Closer-----park----------999-----1) +#exten => 1234,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 360; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $channel_group = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $parked_by = $ARGV_vars[2]; + $park_extension = $ARGV_vars[3]; + $status = $ARGV_vars[4]; + $list_id = $ARGV_vars[5]; + $phone_code = $ARGV_vars[6]; + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + $phone_number=''; + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + + +$AGI->stream_file('beep'); + + if ($V) {print STDERR "\nINBOUND CALL VDCL STARTED\n";} + +#&enter_pin_number; + +$pin = '123456'; +$fronter = $pin; + +if ($M) {print STDERR "+++++ INBOUND CALL VDCL STARTED : |$unique_id|$channel_group|$channel|$extension|$type|$callerid-$pin|$now_date\n";} + +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|\n";} + + +if ($V) {print STDERR "\nINBOUND CALL RECEIVED IN FROM VDCL: $callerid $channel\n";} +if ($M) {print STDERR "+++++ INBOUND VDCL START : |$unique_id|$channel|$extension|$type|$now_date\n";} + +if ($channel =~ /Local/i) +{ +if ($M) {print STDERR "+++++ VDCL START LOCAL CHANNEL: EXITING\n";} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +### insert a record into the vicidial_list table +$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBOUND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');"; +$dbhA->query($stmtA); + $dbhA->query("select LAST_INSERT_ID() LIMIT 1;"); + if ($dbhA->has_selected_record) + { + $iterA=$dbhA->create_record_iterator; + while ($recordA = $iterA->each) + {$insert_lead_id = "$recordA->[0]";} + } +$new_lead_id = $insert_lead_id; +if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";} + + $PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; + ### set the callerid + print "SET CALLERID $YqueryCID\n"; + checkresult($result); + print STDERR "callerID changed: $YqueryCID\n"; + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')"; +$dbhA->query($stmtA); +if($M){print STDERR "\n|$stmtA|\n";} + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";} + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDCL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$new_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if($M){print STDERR "\n|$stmtA|\n";} +$dbhA->query($stmtA); +if ($M) {print STDERR "-- VDXL : |$new_lead_id|insert to vicidial_closer_log\n";} + +$VDADlead_id = $new_lead_id; + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $stmtA = "SELECT next_agent_call FROM vicidial_inbound_groups where group_id='$channel_group';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$new_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|update of vla table: $channel_group|$server_ip\n";} + # if ($M) {print STDERR "|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id LIKE \"%CLOSER%\" and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + else + { + print STDERR "NNNNNNNNNN No agent record found!!!\n"; + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$new_lead_id' order by call_date desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n";} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$new_lead_id' order by call_date desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = '360'; + + $stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### get ready to hangup dropped call + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$server_ip' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vac record deleted: |$affected_rows| $channel_group|$server_ip\n";} + +# $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; +# if($M){print STDERR "\n\n|$stmtA|\n";} +# $dbhA->query("$stmtA"); +# my $affected_rows = $dbhA->get_affected_rows_length; +# if ($M) {print STDERR "-- VDCL vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_closer_log update: |$affected_rows|$new_lead_id\n";} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$new_lead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDCL vicidial_list update: |$affected_rows|$new_lead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent \ No newline at end of file diff --git a/agi-VDADtransfer.agi b/agi-VDADtransfer.agi new file mode 100644 index 0000000..5e77099 --- /dev/null +++ b/agi-VDADtransfer.agi @@ -0,0 +1,474 @@ +#!/usr/bin/perl +# +# agi-VDADtransfer.agi version 0.3 +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 50322-1246 changed callerid handling to allow for custom callerid +# 60119-1408 fixed calleridname issue with 1.2 tree for custom CID +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 10; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VDAD START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$AST_ver|$priority|\n";} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + +if (!$DB_port) {$DB_port='3306';} + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$record->[0]"; + $VDADphone = "$record->[1]"; + $VDADphone_code = "$record->[2]"; + $VDADlead_id = "$record->[3]"; + $VDADcall_time = "$record->[4]"; + } + } + + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } + $stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order=''; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### use manager middleware-app to connect the next call to the meetme room + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + + + + $dbhA->close; + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agi-VDADtransferSURVEY.agi b/agi-VDADtransferSURVEY.agi new file mode 100644 index 0000000..243357c --- /dev/null +++ b/agi-VDADtransferSURVEY.agi @@ -0,0 +1,623 @@ +#!/usr/bin/perl +# +# agi-VDADtransferSURVEY.agi version 0.4 +# +# runs when a call comes in from the VICIDIAL auto_dialer. This script will +# send the calls out to the reps that are logged in if called person presses key. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8366,1,AGI(call_log.agi,${EXTEN}) +# exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60119-1408 fixed calleridname issue with 1.2 tree for custom CID +# + +$V = 1; # set to 1 for verbose mode +$M = 1; # set to 1 for 2 line messages mode + +$DROP_TIME = 10; ### number of seconds to wait until you drop a waiting call + +### Make sure this file is in a path or put the absolute path to it +require("/home/cron/AST_SERVER_conf.pl"); # local configuration file + +use Net::MySQL; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + print STDERR "callerID changed: $callerid\n"; + } + + +if ($V) +{ + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } +} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +if ($V) {print STDERR "AGI Environment Dump: |$unique_id|$channel|$extension|$type|$callerid|$priority|\n";} + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($V) {print STDERR "\nCALL RECEIVED IN FROM VDAD: $callerid $channel $priority\n";} +if ($M) {print STDERR "+++++ VDAD START : |$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date|$priority|\n";} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($M) {print STDERR "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority\n";} +if ($priority > 2) {sleep(1);} +exit; +} + + + + +$AGI->stream_file('beep'); + + my $dbhA = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n"; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';"; +$dbhA->query("$stmtA"); +if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $DBvoicemail_dump_exten = "$record->[0]"; + $DBext_context = "$record->[1]"; + $DBanswer_transfer_agent = "$record->[2]"; + $DBSERVER_GMT = "$record->[3]"; + $DBasterisk_version = "$record->[4]"; + $DBmax_vicidial_trunks = "$record->[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + } + } + + $stmtA = "UPDATE vicidial_list set status='PU' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER\n";} + + &enter_pin_number; + +if ($V) {print STDERR "+++++ VDAD STATUS : pressed $pin|$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date\n";} + +if ($pin !~ /^1|^2|^3|^8|^0/) {exit;} + +if (!$DB_port) {$DB_port='3306';} + + + + + +if ($pin =~ /^1|^2|^3|^0/) +{ +$voter=''; + +if ($pin == "1") {$voter = 'DEMOCRAT';} +if ($pin == "2") {$voter = 'REPUBLICAN';} +if ($pin == "3") {$voter = 'INDEPENDANT';} +if ($pin == "0") {$voter = 'OPERATOR';} + +$stmtA = "UPDATE vicidial_list set security_phrase='$voter' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_list VOTER update: |$affected_rows|$CIDlead_id|$voter\n";} + +# Thank you for your response, we would now like to transfer you to a poll-taker for just a few more questions. Please stay on the line. + +$AGI->stream_file('US_pol_survey_transfer'); + +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADcampaign = "$record->[0]"; + $VDADphone = "$record->[1]"; + $VDADphone_code = "$record->[2]"; + $VDADlead_id = "$record->[3]"; + $VDADcall_time = "$record->[4]"; + } + } + + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if($M){print STDERR "\n|$stmtA|\n";} + $dbhA->query($stmtA); + + if ($M) {print STDERR "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid\n";} + + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN...\n"; + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + print STDERR "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer\n"; + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } + $stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $CAMP_callorder = "$record->[0]"; + } + } + + $agent_call_order=''; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + + $rec_countWAIT=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$server_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $rec_countWAIT = "$record->[0]"; + } + } + if ($rec_countWAIT < 1) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$server_ip\n|$stmtA|\n";} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$server_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADconf_exten = "$record->[0]"; + $VDADuser = "$record->[1]"; + $VDADextension = "$record->[2]"; + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";} + + $stmtA = "UPDATE vicidial_list set status='XFER' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER\n";} + + $dbhA->close; + + print STDERR "\nexiting the VDAD app, transferring call to $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n"; + + exit; + } + } + else + { + print STDERR "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|\n"; + } + + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +$drop_timer++; +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + $rec_countCUSTDATA=0; + while ( $record = $iter->each) + { + $VDADvoicemail_ext = "$record->[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + } + } + } + + + ### use manager middleware-app to connect the next call to the meetme room + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($VDADvoicemail_ext)>0) + { ### if there is a voicemailbox defined then send the dropped call there instead of dropping it + print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n"; + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $dbhA->query($stmtA) or die "Couldn't execute query:\n"; + if ($M) {print STDERR "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager\n";} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_log update: |$affected_rows|$uniqueid\n";} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} + $dbhA->query("$stmtA"); + my $affected_rows = $dbhA->get_affected_rows_length; + if ($M) {print STDERR "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id\n";} + +} + +} ### end if pressed 1,2,3 or 0 + + + + + +else ### user pressed 8 to not be contacted again +{ + +$AGI->stream_file('US_thanks_no_contact'); + +$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vac record deleted: |$affected_rows| $VDADcampaign|$server_ip\n";} + +$stmtA = "UPDATE vicidial_log set status='DNC',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_log update: DNC|$affected_rows|$uniqueid\n";} + +$stmtA = "UPDATE vicidial_list set status='DNC' where lead_id = '$CIDlead_id';"; + if($M){print STDERR "\n\n|$stmtA|\n";} +$dbhA->query("$stmtA"); +my $affected_rows = $dbhA->get_affected_rows_length; +if ($M) {print STDERR "-- VDAD vicidial_list update: DNC|$affected_rows|$CIDlead_id\n";} + + +exit; +} + + $dbhA->close; + + + +exit; + +sub enter_pin_number +{ +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +# Hello, we are conducting a simple survery today, if you are a voter and registered as a Democrat, please press 1. If you are registered as a Republican, please press 2. If you are registered as an Independant or other party please press 3. If you do not want to be contacted again, please press 8. + +$interrupt_digit = $AGI->stream_file('US_pol_survey_hello','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000')); # wait 0.2 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### Hello, you've been chosen to receive a great deal on travel to Florida, if you are insterested please press one on your phone now,,,,,If you would not like to be contacted again please press 2 diff --git a/agi-dtmf.agi b/agi-dtmf.agi new file mode 100644 index 0000000..446dca8 --- /dev/null +++ b/agi-dtmf.agi @@ -0,0 +1,98 @@ +#!/usr/bin/perl +# +# agi-dtmf.agi - script for playing DTMF tones received as the callerid field +# +# DTMF sound files must be in /var/lib/asterisk/sounds for this to work +# +# Accepted values are: 1 2 3 4 5 6 7 8 9 0 # * , +# comma means pause for 1 second +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$|=1; +while() { + chomp; + last unless length($_); + if (/^agi_(\w+)\:\s+(.*)$/) { + $AGI{$1} = $2; + } + if (/^agi_callerid\:\s+(.*)$/) {$caller_id = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$caller_idname = $1;} +} + +print STDERR "AGI Environment Dump:\n"; +foreach $i (sort keys %AGI) { + print STDERR " -- $i = $AGI{$i}\n"; +} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second + +use Asterisk::AGI; +my $agi = new Asterisk::AGI; + +my $clid = $agi->get_variable('CALLERID'); +my $clidname = $agi->get_variable('CALLERIDNAME'); + +print STDERR "X. |$clid|$caller_id|$clidname|\n"; + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + print STDERR "FAIL ($res)\n"; + $fail++; + } else { + print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +### sleep for 30 hundredths of a second +usleep(1*300*1000); + +print "STREAM FILE silence \"\"\n"; + +$caller_id = "$caller_id$caller_idname"; + +@CALLERID_DIGITS = split(//, $caller_id); + +foreach (@CALLERID_DIGITS) +{ + +if ($CALLERID_DIGITS[$g] =~ /\d/) + { + print "STREAM FILE $CALLERID_DIGITS[$g] \"\"\n"; + print STDERR "DIGIT: $CALLERID_DIGITS[$g]\n"; + } +else + { + if ($CALLERID_DIGITS[$g] =~ /\#/) {print "STREAM FILE hash \"\"\n";} + if ($CALLERID_DIGITS[$g] =~ /\*/) {print "STREAM FILE star \"\"\n";} + if ($CALLERID_DIGITS[$g] =~ /\,/) {sleep(1);} + print STDERR "NON-DIGIT: $CALLERID_DIGITS[$g]\n"; + } +$g++; + +### sleep for 20 hundredths of a second +usleep(1*150*1000); + +print "STREAM FILE silence \"\"\n"; + +### sleep for 10 hundredths of a second +usleep(1*100*1000); +} + +print "STREAM FILE silence \"\"\n"; +$result = ; +checkresult($result); + diff --git a/astGUIclient_1.1.0.pl b/astGUIclient_1.1.0.pl new file mode 100644 index 0000000..8070068 --- /dev/null +++ b/astGUIclient_1.1.0.pl @@ -0,0 +1,4793 @@ +#!/usr/local/ActivePerl-5.8/bin/perl -w +# +# astGUIclient_1.1.0.pl version 1.1.0 for Perl/Tk +# by MattF started 2003/10/29 +# +# Description: +# - Grabs live call info from a DB updated every second +# - Displays live status of users phones and Zap/IAX/SIP/Local channels +# - Displays number of voicemail messages new and old +# - Allows calls to be placed from GUI and directed to phone +# - Allows blind internal, external, voicemail call transfers +# - Allows call recording by click of button +# - Allows conference calling of up to 6 channels through GUI +# - Administrative Hangup of any live Zap/IAX/SIP/Local channel +# - Administrative switch user function +# - Call Parking sends calls to park ext and then redirects to phone ext +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with Digium +# Zaptel T1 cards or IAX trunks and SIP VOIP hardphones or softphones as +# extensions, it could be adapted to other functions, but I designed it +# specifically for Zap/IAX/SIP users. The program will run on UNIX Xwindows and +# Win32 providing the following criteria are met: +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# ActiveState Perl is recommended on UNIX due to memory leak in generic perl +# Both - Net::MySQL and Net::Telnet perl modules loaded +# +# For this program to work you also need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# On the server side the AST_update.pl program must always be running on a +# machine somewhere(it is recommended that AST_update be run on the Asterisk +# server locally) for the client app to receive live information and function +# properly, also there are Asterisk conf file settings and +# MySQL databases that must be present for the client app to work. +# Information on these is detailed in the README file +# +# You now have the option for this program to send Action commands either +# directly to the Asterisk machine, or have them entered into the central +# queue system. It is recommended to use the central queue system and if this +# program will be heavily used it is strongly encouraged for you to use the +# central queue system to avoid the problem of Manager buffer-overflow +# deadlocking that can occur with remote manager connections. You can find +# directions on how to install the central queue system in the README.txt file +# To enable the central queue system for this client set: +# $QUEUE_ACTION_enabled = 1; in the AST_VICI_conf.pl file +# +# Use this command to debug with ptkdb and uncomment Devel::ptkdb module below +# perl -d:ptkdb C:\AST_VICI\astGUIclient_1.1.0.pl +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# version changes: +# 50110-1040 - modified to add Zap and IAX2 clients (differentiate from trunks) +# 50120-0955 - modified to change configuration location to DB +# 50225-1829 - fixed Zap client recording bug +# 50311-1420 - optimized recently-dialed-numbers queries + +# some script specific initial values +$build = '50311-1420'; +$version = '1.1.0'; +$VM_messages='0'; +$VM_old_messages='0'; +$DASH='-'; +$USUS='__'; +$SLASH='/'; +$AMP='@'; +$park_frame_list_refresh = 0; +$Default_window = 1; +$zap_frame_list_refresh = 1; +$updater_duplicate_counter = 0; +$updater_duplicate_value = ''; +$updater_warning_up=0; +$open_dialpad_window_again = 0; +$LookupID_and_log = ''; + + +# DB table variables for testing + $parked_channels = 'parked_channels'; + $live_channels = 'live_channels'; + $live_sip_channels = 'live_sip_channels'; + $server_updater = 'server_updater'; +# $parked_channels = 'TEST_parked_channels'; +# $live_channels = 'TEST_live_channels'; +# $live_sip_channels = 'TEST_live_sip_channels'; +# $server_updater = 'TEST_server_updater'; + +require 5.002; + +### libs path, where the program looks for config files and perl libs +use lib ".\\",".\\libs", './', './libs', '../libs', '/usr/local/perl_TK/libs', 'C:\\AST_VICI\\libs', 'C:\\cygwin\\usr\\local\\perl_TK\\libs'; + +### Make sure this file is in a libs path or put the absolute path to it +require("AST_VICI_conf.pl"); # local configuration file + +if (!$DB_port) {$DB_port='3306';} + +#use Devel::ptkdb; # uncomment if you want to debug with ptkdb + +use Net::MySQL; +use Net::Telnet (); + +sub idcheck_connect; +sub connect_to_db; + +&idcheck_connect; ### connect and define custom variables + +if ($enable_persistant_mysql) {&connect_to_db;} + +use English; +use Tk; +use Tk::DialogBox; +use Tk::BrowseEntry; +use Tk::Animation; + +sub connect_to_db; +sub start_recording; +sub stop_recording; +sub get_online_sip_users; +sub get_online_channels; +sub get_parked_channels; + +sub Open_Help ; +sub Dial_Number; +sub Local_Xfer; +sub Voicemail_Xfer; +sub Start_Conference; +sub Stop_Conference; +sub Switch_Your_ID; +sub Dial_Outside_Number; + +sub Dial_Line; +sub Park_Line; +sub Join_Line; +sub Hangup_Line; +sub Hijack_Line; +sub Pickup_Line; +sub validate_conf_lines; +sub Join_Conference; +sub dtmf_dialpad_window; +sub conf_send_dtmf; +sub Zap_Hangup; +sub SIP_Hangup; +sub Zap_Monitor; +sub View_Parked; + +### Create new Perl Tk window instance and name it + my $MW = MainWindow->new; + + $MW->title("astGUIclient - $version"); + $MW->Label(-text => "Build $build ")->pack(-side => 'bottom'); + + my $ans; + +### Time/Date display at the top of the screen + my $time_frame = $MW->Frame()->pack(-expand => '1', -fill => 'both', -side => 'top'); + my $time_value = $time_frame->Entry(-width => '26', -relief => 'sunken')->pack(-side => 'top'); + +### config file defined phone ID + my $login_frame = $MW->Frame()->pack(-expand => '1', -fill => 'both', -side => 'top'); + $login_frame->Label(-text => "your ID:")->pack(-side => 'left'); + my $login_value = $login_frame->Entry(-width => '15', -relief => 'sunken')->pack(-side => 'left'); + $login_value->insert('0', $SIP_user); + + + +### if enabled show the voicemail button bitmap frame +if ($voicemail_button_enabled) + { + my $voicemail_button_frame = $login_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'left'); + $voicemail_button_frame->Label(-text => " ")->pack(-side => 'left'); + + my $vm_ind = "$install_directory/libs/vm_indicator_anim.gif"; + $vm_ind_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_ind); + $vm_ind_anim->set_image(0); + $voicemail_button_frame->Label(-image => $vm_ind_anim)->pack(-side => 'left'); + $vm_ind_anim->start_animation(50); + + $vm_button = $voicemail_button_frame->Photo(-file => "$install_directory/libs/voicemail_up.gif"); + $vm_new = $voicemail_button_frame->Photo(-file => "$install_directory/libs/voicemail_new.gif"); + $vm_old = $voicemail_button_frame->Photo(-file => "$install_directory/libs/voicemail_old.gif"); + + my $vm_digits = "$install_directory/libs/voicemail_digits.gif"; + $vm_new_1_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_new_2_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_new_3_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_old_1_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_old_2_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_old_3_anim = $voicemail_button_frame->Animation(-format => 'gif', -file => $vm_digits); + $vm_new_1_anim->set_image(10); + $vm_new_2_anim->set_image(10); + $vm_new_3_anim->set_image(10); + $vm_old_1_anim->set_image(10); + $vm_old_2_anim->set_image(10); + $vm_old_3_anim->set_image(10); + + $vm_ind_anim->stop_animation(0); + + + ### button below current phones box that allows user to change IDs + my $voicemail_button = $voicemail_button_frame->Button(-text => 'VOICEMAIL', -width => -1, -image => $vm_button, -relief => 'flat', + -command => sub + { + $VM_button_dial=1; + Dial_Outside_Number; + }); + $voicemail_button->pack(-side => 'left', -expand => 'no', -fill => 'none'); + + $voicemail_button_frame->Label(-image => $vm_new)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_new_1_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_new_2_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_new_3_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_old)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_old_1_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_old_2_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + $voicemail_button_frame->Label(-image => $vm_old_3_anim, -borderwidth => 0)->pack(-side => 'left', -anchor =>'w'); + } + + +### Active outside channel if the phone is on one + my $channel_value = $login_frame->Entry(-width => '15', -relief => 'sunken')->pack(-side => 'right'); + $channel_value->insert('0', ''); + $login_frame->Label(-text => "current channel:")->pack(-side => 'right'); + +### main frame for the buttons and list of the app + my $main_frame = $MW->Frame()->pack(-expand => '1', -fill => 'both', -side => 'top'); + + + + +######################################################## +### Frame for current enabled phones and optional switch ID button + + my $current_phones_frame = $main_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'left'); + $current_phones_frame->Label(-text => "Live Extensions:")->pack(-side => 'top'); + + ### list box for current phones in system + my $SIP_user_list = $current_phones_frame->Listbox(-relief => 'sunken', + -width => -1, # Shrink to fit + -selectmode => 'single', + -exportselection => 0, + -height => 20, + -setgrid => 'yes'); + my @items = qw(One Two Three Four Five Six Seven + Eight Nine Ten Eleven Twelve); + foreach (@items) { + $SIP_user_list->insert('end', $_); + } + my $scroll = $main_frame->Scrollbar(-command => ['yview', $SIP_user_list]); + $SIP_user_list->configure(-yscrollcommand => ['set', $scroll]); + $SIP_user_list->pack(-side => 'top', -fill => 'both', -expand => 'yes'); + $scroll->pack(-side => 'left', -fill => 'y'); + $SIP_user_list->selectionSet('0'); + + if ($user_switching_enabled) + { + ### button below current phones box that allows user to change IDs + my $switch_your_id = $current_phones_frame->Button(-text => 'SWITCH YOUR ID', -width => -1, + -command => sub + { + Switch_Your_ID; + }); + $switch_your_id->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + } + + + + +######################################################## +### Frame for current live phones, live Zap/IAX Channels(trunks) and live SIP/Local Channels(clients) + + my $live_phones_frame = $main_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'right'); + $live_phones_frame->Label(-text => "Busy: Outside Lines: Local Extensions: ")->pack(-side => 'top'); + + my $zap_frame = $live_phones_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'right'); + my $zap_list_frame = $zap_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'top'); + + ### list box for current sips/locals that are on live calls right now + my $live_sip = $zap_list_frame->Listbox(-relief => 'sunken', + -width => 19, # Shrink to fit + -selectmode => 'single', + -exportselection => 0, + -height => 20, + -setgrid => 'yes'); + foreach (@items) { + $live_sip->insert('end', $_); + } + my $scrollS = $zap_list_frame->Scrollbar(-command => ['yview', $live_sip]); + $live_sip->configure(-yscrollcommand => ['set', $scrollS]); + $live_sip->pack(-side => 'right', -fill => 'both', -expand => 'yes'); + $scrollS->pack(-side => 'right', -fill => 'y'); + $live_sip->selectionSet('0'); + + ### list box for current Zaps/IAXs that are on live calls right now + my $live_zap = $zap_list_frame->Listbox(-relief => 'sunken', + -width => 15, # Shrink to fit + -selectmode => 'single', + -exportselection => 0, + -height => 20, + -setgrid => 'yes'); + foreach (@items) { + $live_zap->insert('end', $_); + } + my $scrollA = $zap_list_frame->Scrollbar(-command => ['yview', $live_zap]); + $live_zap->configure(-yscrollcommand => ['set', $scrollA]); + $live_zap->pack(-side => 'right', -fill => 'both', -expand => 'yes'); + $scrollA->pack(-side => 'left', -fill => 'y'); + $live_zap->selectionSet('0'); + + if ($admin_hangup_enabled) + { + my $hangup_buttons_frame = $zap_frame->Frame()->pack(-expand => 'no', -fill => 'x', -side => 'bottom'); + + ### button at the bottom of the Zap/IAX listbox to hangup Zap/IAX channels + my $zap_hangup_button = $hangup_buttons_frame->Button(-text => 'Trunk Hangup', -width => -1, + -command => sub + { + $zap_frame_list_refresh = 1; + Zap_Hangup; + }); + $zap_hangup_button->pack(-side => 'left', -expand => '1', -fill => 'both'); + + ### button at the bottom of the sip/local listbox to hangup sip channels + my $sip_hangup_button = $hangup_buttons_frame->Button(-text => 'Local Hangup', -width => -1, + -command => sub + { + $sip_frame_list_refresh = 1; + SIP_Hangup; + }); + $sip_hangup_button->pack(-side => 'right', -expand => '1', -fill => 'both'); + } + + my $ext_frame = $live_phones_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'right'); + my $ext_list_frame = $ext_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'top'); + + ### list box for current live busy extensions that are on Zap/IAX calls + my $live_ext = $ext_list_frame->Listbox(-relief => 'sunken', + -width => 8, # Shrink to fit + -selectmode => 'single', + -exportselection => 0, + -height => 20, + -setgrid => 'yes'); + foreach (@items) { + $live_ext->insert('end', $_); + } + my $scrollB = $ext_list_frame->Scrollbar(-command => ['yview', $live_ext]); + $live_ext->configure(-yscrollcommand => ['set', $scrollB]); + $live_ext->pack(-side => 'right', -fill => 'both', -expand => 'yes'); + $scrollB->pack(-side => 'right', -fill => 'y'); + $live_ext->selectionSet('0'); + + ### button at the bottom of the busy extensions listbox to monitor Zap channels + my $zap_monitor_button = $ext_frame->Button(-text => 'Monitor', -width => -1, + -command => sub + { + Zap_Monitor; + }); + $zap_monitor_button->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + + + + +######################################################## +### Frame for middle buttons and entries + + my $middle_bottons_frame = $main_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'bottom'); + + ### button at the bottom to show parked channels + my $view_park_gif = "$install_directory/libs/buttons.gif"; + $view_park_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $view_park_gif); + my $view_park_button = $middle_bottons_frame->Button(-text => 'VIEW PARKED CALLS', -width => -1, -image => $view_park_gif_anim, -relief => 'flat', + -command => sub + { + View_Parked; + }); + $view_park_button->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $view_park_gif_anim->set_image(14); + $view_park_button->configure(-state => 'disabled'); + + ### display field that shows the line that was last parked + my $last_parked_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'bottom'); + $last_parked_frame->Label(-text => "Parked:")->pack(-side => 'left'); + my $last_parked_value = $last_parked_frame->Entry(-width => '10', -relief => 'sunken')->pack(-side => 'right'); + $last_parked_value->insert('0', ''); + my $last_parked_spacer_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'top'); + $last_parked_spacer_frame->Label(-text => "----- -----")->pack(-side => 'bottom'); + + ### button to put the current Zap/IAX channel you are on in Park + my $call_park_gif = "$install_directory/libs/buttons.gif"; + $call_park_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $call_park_gif); + my $call_park_button = $middle_bottons_frame->Button(-text => 'PARK THIS CALL', -width => -1, -image => $call_park_gif_anim, -relief => 'flat', + -command => sub + { + $main_call_park=1; + $PARK = $channel_value->get; + $CHAN=''; + $last_parked_value->delete('0', 'end'); + $last_parked_value->insert('0', "$PARK"); + Park_Line; + $main_call_park=0; + }); + $call_park_button->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $call_park_gif_anim->set_image(12); + $call_park_button->configure(-state => 'disabled'); + + + ### button to blind transfer a call to an outside number + my $xfer_out_gif = "$install_directory/libs/buttons.gif"; + $xfer_out_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $xfer_out_gif); + my $xfer_outside_number = $middle_bottons_frame->Button(-text => 'XFER TO OUTSIDE NUM', -width => -1, -image => $xfer_out_gif_anim, -relief => 'flat', + -command => sub + { + $xfer_out_blind=1; + Dial_Outside_Number; + }); + $xfer_outside_number->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $xfer_outside_number->configure(-state => 'disabled'); + $xfer_out_gif_anim->set_image(16); + + ### button at the bottom to dial either a typed in number or a browsebox selected number + my $dial_out_gif = "$install_directory/libs/buttons.gif"; + $dial_out_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $dial_out_gif); + my $dial_outside_number = $middle_bottons_frame->Button(-text => 'DIAL OUTSIDE NUMBER', -width => -1, -image => $dial_out_gif_anim, -relief => 'flat', + -command => sub + { + Dial_Outside_Number; + }); + $dial_outside_number->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $dial_out_gif_anim->set_image(1); + + if ($AGI_call_logging_enabled) + { + $recent_dial_listbox=$middle_bottons_frame->BrowseEntry(-background => '#CCCCCC',-label => "Recent:",-width => '2')->pack(-expand => '1', -fill => 'both', -side => 'bottom'); + $recent_dial_listbox->insert('end', ''); + } + + my $dial_number_frame = $middle_bottons_frame->Frame()->pack(-expand => '1', -fill => 'both', -side => 'bottom'); + + # $dial_number_frame->Label(-text => "----- -----")->pack(-side => 'top'); + $dial_number_frame->Label(-text => "Outside number to dial:")->pack(-side => 'top'); + my $dial_number_value = $dial_number_frame->Entry(-width => '12', -relief => 'sunken')->pack(-side => 'bottom'); + + + ### button for a popup HELP screen with user directions + my $help_gif = "$install_directory/libs/buttons.gif"; + $help_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $help_gif); + my $Open_Help = $middle_bottons_frame->Button(-text => 'HELP', -width => -1, -image => $help_gif_anim, -relief => 'flat', + -command => sub + { + Open_Help; + }); + $Open_Help->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $Open_Help->configure(-state => 'normal'); + $help_gif_anim->set_image(9); + + + ### button for a blind transfer live call within asterisk to another extension + my $local_xfer_gif = "$install_directory/libs/buttons.gif"; + $local_xfer_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $local_xfer_gif); + my $local_xfer = $middle_bottons_frame->Button(-text => 'blind int xfer', -width => -1, -image => $local_xfer_gif_anim, -relief => 'flat', + -command => sub + { + Local_Xfer; + }); + $local_xfer->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $local_xfer->configure(-state => 'disabled'); + $local_xfer_gif_anim->set_image(18); + + + ### button for a blind transfer live call within asterisk to voicemailbox + my $vmail_xfer_gif = "$install_directory/libs/buttons.gif"; + $vmail_xfer_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $vmail_xfer_gif); + my $vmail_xfer = $middle_bottons_frame->Button(-text => 'blind vmail xfer', -width => -1, -image => $vmail_xfer_gif_anim, -relief => 'flat', + -command => sub + { + Voicemail_Xfer; + }); + $vmail_xfer->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $vmail_xfer->configure(-state => 'disabled'); + $vmail_xfer_gif_anim->set_image(20); + + + ### button for a local call within asterisk to another extension + my $local_call_gif = "$install_directory/libs/buttons.gif"; + $local_call_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $local_call_gif); + my $local_conf = $middle_bottons_frame->Button(-text => 'Intrasystem Call', -width => -1, -image => $local_call_gif_anim, -relief => 'flat', + -command => sub + { + Dial_Number; + }); + $local_conf->pack(-side => 'bottom', -expand => 'no', -fill => 'both'); + $local_conf->configure(-state => 'normal'); + $local_call_gif_anim->set_image(7); + + + ### button to start recording, only activated if the phone is on an active outside line + my $start_rec_gif = "$install_directory/libs/buttons.gif"; + $start_rec_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $start_rec_gif); + my $start_recording = $middle_bottons_frame->Button(-text => 'START RECORDING', -width => -1, -image => $start_rec_gif_anim, -relief => 'flat', + -command => sub + { + start_recording; + $RECORD='-'; + }); + $start_recording->pack(-side => 'top', -expand => 'no', -fill => 'both'); + $start_recording->configure(-state => 'disabled'); + $start_rec_gif_anim->set_image(4); + + ### button to stop recording + my $stop_rec_gif = "$install_directory/libs/buttons.gif"; + $stop_rec_gif_anim = $middle_bottons_frame->Animation(-format => 'gif', -file => $stop_rec_gif); + my $stop_recording = $middle_bottons_frame->Button(-text => 'STOP RECORDING', -width => -1, -image => $stop_rec_gif_anim, -relief => 'flat', + -command => sub + { + stop_recording; + }); + $stop_recording->pack(-side => 'top', -expand => 'no', -fill => 'both'); + $stop_rec_gif_anim->set_image(5); + + ### display field that shows -- RECORDING-- during recording active and the length of recording when recording is stopped + my $rec_msg_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'top'); + $rec_msg_frame->Label(-text => "RECORDING MESSAGE:")->pack(-side => 'top'); + my $rec_msg_value = $rec_msg_frame->Entry(-width => '24', -relief => 'sunken')->pack(-side => 'top'); + $rec_msg_value->insert('0', ''); + + ### display field that shows the filename as soon as recording is started + my $rec_fname_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'top'); + $rec_fname_frame->Label(-text => "RECORDING FILENAME:")->pack(-side => 'top'); + my $rec_fname_value = $rec_fname_frame->Entry(-width => '24', -relief => 'sunken')->pack(-side => 'top'); + $rec_fname_value->insert('0', ''); + + ### display field that shows the unique recording ID in the database only after the recording session is finished + my $rec_recid_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'top'); + $rec_recid_frame->Label(-text => "RECORDING ID:")->pack(-side => 'left'); + my $rec_recid_value = $rec_recid_frame->Entry(-width => '10', -relief => 'sunken')->pack(-side => 'right'); + $rec_recid_value->insert('0', ''); + my $rec_recid_spacer_frame = $middle_bottons_frame->Frame()->pack(-expand => '2', -fill => 'both', -side => 'top'); + $rec_recid_spacer_frame->Label(-text => "----- -----")->pack(-side => 'bottom'); + + + + + + + +######################################################## +### Frame for Conference control + + + my $conf_frame_control = $MW->Frame()->pack(-expand => '1', -fill => 'both', -side => 'bottom'); + + ### button at the bottom to enter a conference call with the current line + my $start_conf_gif = "$install_directory/libs/buttons.gif"; + $start_conf_gif_anim = $conf_frame_control->Animation(-format => 'gif', -file => $start_conf_gif); + my $initiate_conference = $conf_frame_control->Button(-text => 'START CONFERENCE', -width => -1, -image => $start_conf_gif_anim, -relief => 'flat', + -command => sub + { + Start_Conference; + }); + $initiate_conference->pack(-side => 'right', -expand => 'no', -fill => 'both'); + $initiate_conference->configure(-state => 'disabled'); + $start_conf_gif_anim->set_image(22); + + my $stop_conf_gif = "$install_directory/libs/buttons.gif"; + $stop_conf_gif_anim = $conf_frame_control->Animation(-format => 'gif', -file => $stop_conf_gif); + my $destroy_conference = $conf_frame_control->Button(-text => 'STOP CONFERENCE', -width => -1, -image => $stop_conf_gif_anim, -relief => 'flat', + -command => sub + { + Stop_Conference; + }); + $destroy_conference->pack(-side => 'right', -expand => 'no', -fill => 'both', -before => $initiate_conference); + $destroy_conference->configure(-state => 'disabled'); + $stop_conf_gif_anim->set_image(24); + + + + + + + + +################################################################################################################ +### Frame for Conferencing