diff --git a/UPGRADE b/UPGRADE index 6d45a783..1e2d86c6 100644 --- a/UPGRADE +++ b/UPGRADE @@ -79,6 +79,11 @@ OTHER CHANGES: interface options in a separate file so that they can be preserved through an upgrade. See options-example.php for more information +17. Added CallCard featureset to allow for pin-number entry before entering an + In-Group by a customer with minute balances and a basic admin interface. + See the CALLCARD.txt doc for more information. + + diff --git a/agi/agi-AGENT_dial_in.agi b/agi/agi-AGENT_dial_in.agi index d6200dc2..b7b307a9 100644 --- a/agi/agi-AGENT_dial_in.agi +++ b/agi/agi-AGENT_dial_in.agi @@ -10,6 +10,7 @@ # user is prompted for their passcode then press # # then the user is forwarded to the active vicidial agent session # +# can be added as an AGI to a Call Menu, or as below: # ;agent dial-in: #exten => 2345,1,Answer ; Answer the line #exten => 2345,2,AGI(agi-AGENT_dial_in.agi) diff --git a/agi/agi-CALLCARD_dial_in.agi b/agi/agi-CALLCARD_dial_in.agi new file mode 100644 index 00000000..82d76fd0 --- /dev/null +++ b/agi/agi-CALLCARD_dial_in.agi @@ -0,0 +1,477 @@ +#!/usr/bin/perl +# +# agi-CALLCARD_dial_in.agi version 0.1 +# +# This script is designed to allow customers the ability to dial in to a DID and +# enter in a PIN number that would look up their account and send on to a +# specified in-group if pin is valid +# +# user is prompted for their PIN number only (no pound '#' required) +# then the user is forwarded to the active vicidial agent session +# +# can be added as an AGI to a Call Menu, or as below: +# Call Menu Entry: "agi-CALLCARD_dial_in.agi,en---3---callcard_pin_enter---callcard_pin_invalid---default" +# ;agent dial-in: +#exten => 2346,1,Answer ; Answer the line +#exten => 2346,2,AGI(agi-CALLCARD_dial_in.agi,en---3---callcard_pin_enter---callcard_pin_invalid---default) +#exten => 2346,3,Hangup +# +# ; Below are the parameters needed for the script to be run properly +# ; 1. language +# ; - en - English +# ; - es - Spanish +# ; 2. maximum attempts before hangup: +# ; - 3 +# ; 3. audio file enter pin number prompt: +# ; - callcard_pin_enter +# ; 4. audio file invalid pin number prompt: +# ; - callcard_pin_invalid +# ; 5. DID pattern to use for in-group forwarding settings: +# ; - default +# ; - USE-ORIGINATING-DID - this option will look up the DID the customer dialed in on and use those settings +# +# other audio files used: +# - pin-number-accepted +# - vm-youhave +# - callcard_minutes_left +# +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# +# CHANGELOG +# 100311-1135 - First build +# + +&get_time_now; + $start_epoch = $now_date_epoch; + +$script = 'agi-CALLCARD_dial_in.agi'; + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +($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";} + +$US='_'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/ivrout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +# defaults: +$language = 'en'; +$maximum_attempts = '3'; +$pin_enter_audio = 'callcard_pin_enter'; +$pin_invalid_audio = 'callcard_pin_invalid'; +$did_ingroup_settings = 'default'; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/---/, $ARGV[0]); + + if (length($ARGV_vars[0]) > 0) {$language = $ARGV_vars[0];} + if (length($ARGV_vars[1]) > 0) {$maximum_attempts = $ARGV_vars[1];} + if (length($ARGV_vars[2]) > 0) {$pin_enter_audio = $ARGV_vars[2];} + if (length($ARGV_vars[3]) > 0) {$pin_invalid_audio = $ARGV_vars[3];} + if (length($ARGV_vars[4]) > 0) {$did_ingroup_settings = $ARGV_vars[4];} + } +if ($language =~ /es/) {$audio_suffix='_es';} +else {$audio_suffix='';} + + +$|=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_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $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;} +$phone_number=$callerid; + +### Grab Server values from the database +$stmtA = "SELECT ext_context,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBext_context = "$aryA[0]"; + $DBagi_output = "$aryA[1]"; + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + + +$AGI->stream_file('sip-silence'); +$AGI->stream_file('sip-silence'); +$AGI->stream_file('sip-silence'); + + +$entry_chances=0; +$VALID_login=0; +$ACTIVE_login=0; +$VDADremDIALstr=''; +while ( ($entry_chances < $maximum_attempts) && ($VALID_login < 1) ) + { + $entry_chances++; + + + &user_password_gather; + + + ###### Check userID and password against vicidial_users table + $stmtA = "SELECT count(*) FROM callcard_accounts where pin='$PIN_number' and status IN('ACTIVE','USED') and balance_minutes > 0;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VALID_login = $aryA[0]; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "validate PIN: |$VALID_login|$stmtA|"; &agi_output;} + + + if ($VALID_login > 0) + { + $AGI->stream_file("pin-number-accepted$audio_suffix"); + } + else + { + $AGI->stream_file("$pin_invalid_audio$audio_suffix"); + } + } + + + +if ($VALID_login < 1) + { + if ($AGILOG) {$agi_string = "DIAL-IN END: Invalid Pin |$VALID_login|$PIN_number|"; &agi_output;} + + $AGI->stream_file("vm-goodbye$audio_suffix"); + + $AGI->hangup(); + + $dbhA->disconnect(); + exit; + } +else + { + $secX = time(); + $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"; + + + ###### Check for the current minute balance to play back to the customer in the callcard_accounts table + $stmtA = "SELECT card_id,balance_minutes,inbound_group_id FROM callcard_accounts where pin='$PIN_number';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $card_id = $aryA[0]; + $balance_minutes = $aryA[1]; + $inbound_group_id = $aryA[2]; + } + $sthA->finish(); + + ###### Check for the current minute balance to play back to the customer in the callcard_accounts table + $stmtA = "SELECT vdl.did_id,did_pattern FROM vicidial_did_log vdl, vicidial_inbound_dids vid where uniqueid='$uniqueid' and vdl.did_id=vid.did_id order by call_date desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $original_did_pattern = $aryA[1]; + } + $sthA->finish(); + + if ($did_ingroup_settings =~ /USE-ORIGINATING-DID/) + {$did_id_search = $original_did_pattern;} + else + {$did_id_search = $did_ingroup_settings;} + $did_id=0; + ###### find the in-group settings to use when forwarding this call + $stmtA = "SELECT did_id FROM vicidial_inbound_dids where did_pattern='$did_id_search';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $did_id = $aryA[0]; + } + $sthA->finish(); + + ##### play customer's balance to them before transferring + $AGI->stream_file("vm-youhave$audio_suffix"); + if ($language=='es') + {$AGI->stream_file("$balance_minutes$audio_suffix");} + else + {$AGI->say_number("$balance_minutes");} + $AGI->stream_file("callcard_minutes_left$audio_suffix"); + + + ##### update callcard_accounts_detail record for this account + $stmtA = "UPDATE callcard_accounts_detail set used_time='$now_date' where card_id='$card_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "callcard_accounts_detail update: |$affected_rows|$now_date|$card_id|"; &agi_output;} + + ##### insert callcard_log record for this call + $stmtA = "INSERT INTO callcard_log set uniqueid='$uniqueid',card_id='$card_id',call_time='$now_date',phone_number='$phone_number',inbound_did='$original_did_pattern',balance_minutes_start='$balance_minutes';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "callcard_log INSERT: |$affected_rows|$stmtA|"; &agi_output;} + + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $forward_extension = "99909*$did_id*$inbound_group_id"; + + if ($AGILOG) {$agi_string = "Customer $PIN_number sent to $forward_extension"; &agi_output;} + + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $forward_extension\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + + + +$dbhA->disconnect(); + +exit; + + + + + +################################################################################ +##### SUBROUTINES ############################################################## +################################################################################ + + +##### BEGIN collect the pin number ###################################### +sub user_password_gather + { + ################################################################################ + # please enter the pin number followed by the pound key + + $interrupt_digit=''; + + $interrupt_digit = $AGI->stream_file("$pin_enter_audio$audio_suffix",'0123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + + $digits_being_entered=1; + $PIN_number=''; + if ($interrupt_digit > 0) + { + # if ($interrupt_digit == 35) {$interrupt_digit='#';} + # if ($interrupt_digit == 42) {$interrupt_digit='*';} + 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;} + + $PIN_number=$interrupt_digit; + } + + $digit_loop_counter=0; + while ( ($digits_being_entered > 0) && ($digit_loop_counter < 8) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input, until the pound key is pressed or 8 digits + if ($digit =~ /\d/) + { + $PIN_number = "$PIN_number$digit"; + print STDERR "digit |$digit| PIN_number |$PIN_number|\n"; + # $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digits_being_entered=0; + } + + $digit_loop_counter++; + } + + $PIN_number =~ s/\D//gi; + if ($PIN_number) {print STDERR "digit collection done|$digit| PIN_number |$PIN_number|\n";} + } + ##### END collect the pin number ############################################### + + + + + +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) {$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"; + $filedate = "$year$mon$mday$hour$min$sec"; + } + + + +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 agi_output + { + if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### + if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} + $agi_string=''; + } + +sub leading_zero($) + { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; + } # End of the leading_zero() routine. diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 6f705ace..1e503d1e 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -314,6 +314,7 @@ if ($extension =~ /^999\d\d\*/) $referring_extension = $EXT_vars[0]; # initial extension sent $did_id = $EXT_vars[1]; # the DID ID to grab settings from + $in_group_override = $EXT_vars[2]; # the in-group override, if set ### Grab DID values from the database $stmtA = "SELECT call_handle_method,agent_search_method,group_id,did_pattern,list_id,phone_code,campaign_id,user,user_unavailable_action,user_route_settings_ingroup,did_route,voicemail_ext,extension,exten_context,phone,server_ip FROM vicidial_inbound_dids where did_id = '$did_id';"; @@ -346,6 +347,30 @@ if ($extension =~ /^999\d\d\*/) {$channel_group = $did_in_group;} } $sthA->finish(); + + if (length($in_group_override) > 1) + { + $igo_valid=0; + ### if in_group_override is set, make sure it's valid + $stmtA = "SELECT count(*) FROM vicidial_inbound_groups where group_id='$in_group_override' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $igo_valid = $aryA[0]; + } + $sthA->finish(); + + if ($igo_valid > 0) + { + $channel_group = $in_group_override; + if ($AGILOG) {$agi_string = "In-Group Override: $in_group_override"; &agi_output;} + } + + } } if ($call_handle_method =~ /^CLOSER/) diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 248b2e6f..ff37d538 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -49,6 +49,7 @@ # 91205-2315 - Added delete_vm_after_email option to voicemail conf generation # 100220-1410 - Added System Settings and Servers custom dialplan entries # 100225-2020 - Change voicemail configuration to use voicemail.conf +# 100312-1012 - Changed TIMEOUT Call Menu function to work with AGI routes # $DB=0; # Debug flag @@ -1656,6 +1657,15 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r else {$menu_prompt_ext .= "exten => s,n,Background($menu_prompt[$i])\n";} + if ($time_check_route =~ /AGI/) + { + $call_menu_options_ext .= "; time check after hours AGI special extension\n"; + $call_menu_options_ext .= "exten => 9999999999999999999988,1,AGI($time_check_route_value)\n"; + + $time_check_route = 'EXTENSION'; + $time_check_route_value = '9999999999999999999988'; + $time_check_route_context = $menu_id[$i]; + } $call_menu_ext .= "\n"; $call_menu_ext .= "; $menu_name[$i]\n"; $call_menu_ext .= "[$menu_id[$i]]\n"; diff --git a/bin/AST_call_log_export.pl b/bin/AST_call_log_export.pl new file mode 100644 index 00000000..83b50449 --- /dev/null +++ b/bin/AST_call_log_export.pl @@ -0,0 +1,620 @@ +#!/usr/bin/perl +# +# AST_call_log_export.pl version: 2.4 +# +# This script is designed to gather basic call logs for a VICIDIAL Outbound calling campaigns and +# post them to a directory. This script is a little different from other report +# scripts in that it will use the "processed" fields in the vicidial_log and +# vicidial_agent_log tables to keep track of the records that it has output. +# +# /usr/share/astguiclient/AST_call_log_export.pl --campaign=GOODB-GROUP1-GROUP3-GROUP4-SPECIALS-DNC_BEDS --output-format=tab-basic --debug --filename=BEDSsaleDATETIME.txt --email-list=test@gmail.com --email-sender=test@test.com +# +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# +# CHANGES +# 100310-0112 - First version +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; +$Q=0; +$DB=0; +$uniqueidLIST='|'; +$dateset=0; + +# Default FTP account variables +$VARREPORT_host = '10.0.0.4'; +$VARREPORT_user = 'cron'; +$VARREPORT_pass = 'test'; +$VARREPORT_port = '21'; +$VARREPORT_dir = 'REPORTS'; + +# default CLI values +$campaign = 'TESTCAMP'; +$output_format = 'tab-basic'; + +$secX = time(); +$time = $secX; + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$yy = ($year - 2000); +$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";} +$timestamp = "$year-$mon-$mday $hour:$min:$sec"; +$filedate = "$year$mon$mday"; +$filedatetime = "$year$mon$mday$hour$min$sec"; +$ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; +$shipdate = "$year-$mon-$mday"; +$start_date = "$year$mon$mday"; +$datestamp = "$year/$mon/$mday $hour:$min"; + + +use Time::Local; + +### find epoch of 2AM today +$TWOAMsec = ( ($secX - ($sec + ($min * 60) + ($hour * 3600) ) ) + 7200); +### find epoch of 2AM yesterday +$TWOAMsecY = ($TWOAMsec - 86400); + +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TWOAMsecY); +$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";} + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--date=YYYY-MM-DD] = date override, otherwise will use processed=N\n"; + print " [--hour-offset=X] = print datetime strings with this hour offset\n"; + print " [--filename=XXX] = Name to be used for file\n"; + print " [--campaign=XXX] = Campaign that sales will be pulled from\n"; + print " [--without-camp=XXX] = Campaign that will be excluded from ALL\n"; + print " [--output-format=XXX] = Format of file. Default \"pipe-standard\"\n"; + print " [--ftp-transfer] = Send results file by FTP to another server\n"; + print " [--email-list=test@test.com:test2@test.com] = send email results to these addresses\n"; + print " [--email-sender=vicidial@localhost] = sender for the email results\n"; + print " [--quiet] = quiet\n"; + print " [--test] = test\n"; + print " [--debug] = debugging messages\n"; + print " [--debugX] = Super debugging messages\n"; + print "\n"; + print " format options:\n"; + print " tab-basic:\n"; + print " call_date phone_number vendor_id status user first_name last_name lead_id list_id campaign_id length_in_sec source_id\n"; + print " pipe-basic:\n"; + print " call_date|phone_number|vendor_id|status|user|first_name|last_name|lead_id|list_id|campaign_id|length_in_sec|source_id|\n"; + print "\n"; + + + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG MODE -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER DEBUG MODE -----\n\n"; + } + if ($args =~ /-quiet/i) + { + $q=1; $Q=1; + } + + if ($args =~ /--hour-offset=/i) + { + @data_in = split(/--hour-offset=/,$args); + $hour_offset = $data_in[1]; + $hour_offset =~ s/ .*//gi; + if (!$Q) {print "\n----- HOUR OFFSET: $hour_offset -----\n\n";} + } + else + {$hour_offset=0;} + if ($args =~ /--date=/i) + { + @data_in = split(/--date=/,$args); + $shipdate = $data_in[1]; + $shipdate =~ s/ .*//gi; + if ($shipdate =~ /today/) + { + $shipdate="$year-$mon-$mday"; + $time = $TWOAMsec; + } + else + { + if ($shipdate =~ /yesterday/) + { + $shipdate="$Tyear-$Tmon-$Tmday"; + $year = $Tyear; + $mon = $Tmon; + $mday = $Tmday; + $time=$TWOAMsecY; + } + else + { + @cli_date = split("-",$shipdate); + $year = $cli_date[0]; + $mon = $cli_date[1]; + $mday = $cli_date[2]; + $cli_date[1] = ($cli_date[1] - 1); + $time = timelocal(0,0,2,$cli_date[2],$cli_date[1],$cli_date[0]); + } + } + if (!$Q) {print "\n----- DATE OVERRIDE: $shipdate -----\n\n";} + $dateset=1; + } + else + { + $time=$TWOAMsec; + $dateset=0; + } + + + if ($args =~ /--campaign=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--campaign=/,$args); + $campaign = $data_in[1]; + $campaign =~ s/ .*$//gi; + $campaignSQL = $campaign; + if ($campaignSQL =~ /-/) + { + $campaignSQL =~ s/-/','/gi; + } + $campaignSQL = "'$campaignSQL'"; + } + if ($args =~ /--without-camp=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--without-camp=/,$args); + $NOTcampaign = $data_in[1]; + $NOTcampaign =~ s/ .*$//gi; + $NOTcampaignSQL = $NOTcampaign; + if ($NOTcampaignSQL =~ /-/) + { + $NOTcampaignSQL =~ s/-/','/gi; + } + $NOTcampaignSQL = "'$NOTcampaignSQL'"; + } + if ($args =~ /--filename=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--filename=/,$args); + $yy = ($year - 2000); + $filename = $data_in[1]; + $filename =~ s/ .*$//gi; + $filename =~ s/YYYY/$year/gi; + $filename =~ s/MM/$mon/gi; + $filename =~ s/DD/$mday/gi; + $filename =~ s/DATETIME/$year$mon$mday$hour$min$sec/gi; + $filename =~ s/DATESPEC/$yy$mon$mday-$hour$min$sec/gi; + $filename_override=1; + } + if ($args =~ /--output-format=/i) + { + @data_in = split(/--output-format=/,$args); + $output_format = $data_in[1]; + $output_format =~ s/ .*$//gi; + } + if ($args =~ /-ftp-transfer/i) + { + if (!$Q) + {print "\n----- FTP TRANSFER MODE -----\n\n";} + $ftp_transfer=1; + } + if ($args =~ /--test/i) + { + $T=1; $TEST=1; + if (!$Q) {print "\n----- TESTING -----\n\n";} + } + if ($args =~ /--email-list=/i) + { + @data_in = split(/--email-list=/,$args); + $email_list = $data_in[1]; + $email_list =~ s/ .*//gi; + $email_list =~ s/:/,/gi; + if (!$Q) {print "\n----- EMAIL NOTIFICATION: $email_list -----\n\n";} + } + else + {$email_list = '';} + + if ($args =~ /--email-sender=/i) + { + @data_in = split(/--email-sender=/,$args); + $email_sender = $data_in[1]; + $email_sender =~ s/ .*//gi; + $email_sender =~ s/:/,/gi; + if (!$Q) {print "\n----- EMAIL NOTIFICATION SENDER: $email_sender -----\n\n";} + } + else + {$email_sender = 'vicidial@localhost';} + } + } +else + { + print "no command line options set, using defaults.\n"; + } +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_host/) && ($CLIREPORT_host < 1) ) + {$VARREPORT_host = $line; $VARREPORT_host =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_user/) && ($CLIREPORT_user < 1) ) + {$VARREPORT_user = $line; $VARREPORT_user =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_pass/) && ($CLIREPORT_pass < 1) ) + {$VARREPORT_pass = $line; $VARREPORT_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_port/) && ($CLIREPORT_port < 1) ) + {$VARREPORT_port = $line; $VARREPORT_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_dir/) && ($CLIREPORT_dir < 1) ) + {$VARREPORT_dir = $line; $VARREPORT_dir =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if ($output_format =~ /^tab-basic$/) + {$DLT = "\t"; $txt='.txt'; if (!$Q) {print "---- tab-basic ----\n";}} +if ($output_format =~ /^pipe-basic$/) + {$DLT = "|"; $txt='.txt'; if (!$Q) {print "---- pipe-basic ----\n";}} + +if (length($campaignSQL) < 2) + { + if (length($NOTcampaignSQL) < 2) + { + $VLcampaignSQL = "vicidial_log.campaign_id NOT IN('')"; + $VLAcampaignSQL = "vicidial_agent_log.campaign_id NOT IN('')"; + } + else + { + $VLcampaignSQL = "vicidial_log.campaign_id NOT IN($NOTcampaignSQL)"; + $VLAcampaignSQL = "vicidial_agent_log.campaign_id NOT IN($NOTcampaignSQL)"; + } + } +else + { + $VLcampaignSQL = "vicidial_log.campaign_id IN($campaignSQL)"; + $VLAcampaignSQL = "vicidial_agent_log.campaign_id IN($campaignSQL)"; + } + +if ($dateset > 0) + { + $VLdateSQL = "call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59'"; + $VLAdateSQL = "event_time > '$shipdate 00:00:01' and event_time < '$shipdate 23:59:59'"; + } +else + { + $VLdateSQL = "processed='N'"; + $VLAdateSQL = "processed='N'"; + } +if (!$Q) + { + print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_call_log_export.pl --\n\n"; + print "This program is designed to gather all outbound calls and post them to a file. \n"; + print "\n"; + print "Campaign: $campaign $VLcampaignSQL\n"; + print "Output Format: $output_format\n"; + print "\n"; + } + +$outfile = "$campaign$US$filedatetime$txt"; +if ($filename_override > 0) {$outfile = $filename;} + +### open the X out file for writing ### +$PATHoutfile = "$PATHweb/vicidial/server_reports/$outfile"; +open(out, ">$PATHoutfile") + || die "Can't open $PATHoutfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$TOTAL_SALES=0; + + +$timezone='-5'; +$stmtA = "SELECT local_gmt FROM servers where server_ip='$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + if ($DBX) {print " $sthArows|$stmtA|\n";} +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $timezone = $aryA[0]; + $sthA->finish(); + } +$offset_timezone = ($timezone + $hour_offset); +$SQLtimezone = sprintf("%10.2f",$timezone); +$SQLtimezone =~ s/\./:/gi; +$SQLtimezone =~ s/:50/:30/gi; +$SQLtimezone =~ s/ //gi; +$SQLoffset_timezone = sprintf("%10.2f",$offset_timezone); +$SQLoffset_timezone =~ s/\./:/gi; +$SQLoffset_timezone =~ s/:50/:30/gi; +$SQLoffset_timezone =~ s/ //gi; +$convert_tz = "'$SQLtimezone','$SQLoffset_timezone'"; + +if (!$Q) + {print "\n----- SQL CONVERT_TZ: $SQLtimezone|$SQLoffset_timezone $convert_tz -----\n\n";} + + + +########################################################################### +########### CURRENT DAY SALES GATHERING outbound-only non-agent handled calls: vicidial_log ###### +########################################################################### +# call_date|phone_number|vendor_id|status|user|first_name|last_name|lead_id|list_id|campaign_id|length_in_sec|source_id| + +$stmtA = "select CONVERT_TZ(call_date,$convert_tz),vicidial_log.phone_number,vendor_lead_code,vicidial_log.status,vicidial_log.user,first_name,last_name,vicidial_list.lead_id,vicidial_log.list_id,campaign_id,length_in_sec,vicidial_list.source_id,uniqueid from vicidial_list,vicidial_log where $VLcampaignSQL and $VLdateSQL and vicidial_log.lead_id=vicidial_list.lead_id and vicidial_log.status IN('DROP','XDROP','NA','AA','AM','AL','AB','ADC','PU','PM','SVYEXT','SVYVM','SVYHU','SVYREC','HXFER','HOLDTO','QVMAIL','RQXFER','CPDATB','CPDB','CPDNA','CPDREJ','CPDINV','CPDSUA','CPDSI','CPDSNC','CPDSR','CPDSUK','CPDSV','CPDUK','CPDERR','TIMEOT','AFTHRS','NANQUE') order by call_date;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +if ($DB) {print "$sthArows|$stmtA|\n";} +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $call_date = $aryA[0]; + $phone_number = $aryA[1]; + $vendor_id = $aryA[2]; + $status = $aryA[3]; + $user = $aryA[4]; + $first_name = $aryA[5]; + $last_name = $aryA[6]; + $lead_id = $aryA[7]; + $list_id = $aryA[8]; + $campaign_id = $aryA[9]; + $length_in_sec = $aryA[10]; + $source_id = $aryA[11]; + $uniqueid = $aryA[12]; + $VLupdateSQL .= "'$uniqueid',"; + + &select_format_loop; + + $TOTAL_SALES++; + $rec_count++; + } +$sthA->finish(); + + +########################################################################### +########### CURRENT DAY SALES GATHERING outbound-only agent handled calls: vicidial_agent_log ###### +########################################################################### +# call_date|phone_number|vendor_id|status|user|first_name|last_name|lead_id|list_id|campaign_id|length_in_sec|source_id| + +$stmtA = "select CONVERT_TZ(event_time,$convert_tz),vicidial_list.phone_number,vendor_lead_code,vicidial_agent_log.status,vicidial_agent_log.user,first_name,last_name,vicidial_list.lead_id,vicidial_list.list_id,campaign_id,talk_sec,vicidial_list.source_id,dead_sec,agent_log_id from vicidial_list,vicidial_agent_log where $VLAcampaignSQL and $VLAdateSQL and vicidial_agent_log.lead_id=vicidial_list.lead_id and vicidial_agent_log.status NOT IN('DROP','XDROP','NA','AA','AM','AL','AB','ADC','PU','PM','SVYEXT','SVYVM','SVYHU','SVYREC','HXFER','HOLDTO','QVMAIL','RQXFER','CPDATB','CPDB','CPDNA','CPDREJ','CPDINV','CPDSUA','CPDSI','CPDSNC','CPDSR','CPDSUK','CPDSV','CPDUK','CPDERR','TIMEOT','AFTHRS','NANQUE','INCALL','','QUEUE') order by event_time;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +if ($DB) {print "$sthArows|$stmtA|\n";} +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $call_date = $aryA[0]; + $phone_number = $aryA[1]; + $vendor_id = $aryA[2]; + $status = $aryA[3]; + $user = $aryA[4]; + $first_name = $aryA[5]; + $last_name = $aryA[6]; + $lead_id = $aryA[7]; + $list_id = $aryA[8]; + $campaign_id = $aryA[9]; + $length_in_sec = ($aryA[10] - $aryA[12]); + $source_id = $aryA[11]; + if ($length_in_sec < 0) {$length_in_sec=0;} + $agent_log_id = $aryA[13]; + + $VLAupdateSQL .= "'$agent_log_id',"; + &select_format_loop; + + $TOTAL_SALES++; + $rec_count++; + } +$sthA->finish(); + + +if ($TEST < 1) + { + ##### update records to processed=Y + $VLupdateSQL .= "''"; + $stmtA = "UPDATE vicidial_log set processed='Y' where uniqueid IN($VLupdateSQL) and processed='N';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + if($DBX){print STDERR "\n|$affected_rows records updated|\n";} + + $VLAupdateSQL .= "''"; + $stmtA = "UPDATE vicidial_agent_log set processed='Y' where agent_log_id IN($VLAupdateSQL) and processed='N';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + if($DBX){print STDERR "\n|$affected_rows records updated|\n";} + } +close(out); + + +###### EMAIL SECTION + +if ( (length($Ealert)>5) && (length($email_list) > 3) ) + { + if (!$Q) {print "Sending email: $email_list\n";} + + use MIME::QuotedPrint; + use MIME::Base64; + use Mail::Sendmail; + + $mailsubject = "VICIDIAL Calls Export $outfile"; + + %mail = ( To => "$email_list", + From => "$email_sender", + Subject => "$mailsubject", + ); + $boundary = "====" . time() . "===="; + $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; + + $message = encode_qp( "VICIDIAL Calls Export:\n\n Attachment: $outfile\n Total Records: $TOTAL_SALES\n" ); + + $Zfile = "$PATHoutfile"; + + open (F, $Zfile) or die "Cannot read $Zfile: $!"; + binmode F; undef $/; + $attachment = encode_base64(); + close F; + + $boundary = '--'.$boundary; + $mail{body} .= "$boundary\n"; + $mail{body} .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; + $mail{body} .= "Content-Transfer-Encoding: quoted-printable\n\n"; + $mail{body} .= "$message\n"; + $mail{body} .= "$boundary\n"; + $mail{body} .= "Content-Type: application/octet-stream; name=\"$outfile\"\n"; + $mail{body} .= "Content-Transfer-Encoding: base64\n"; + $mail{body} .= "Content-Disposition: attachment; filename=\"$outfile\"\n\n"; + $mail{body} .= "$attachment\n"; + $mail{body} .= "$boundary"; + $mail{body} .= "--\n"; + + sendmail(%mail) or die $mail::Sendmail::error; + if (!$Q) {print "ok. log says:\n", $mail::sendmail::log;} ### print mail log for status + + } + + + +# FTP overrides- +# $VARREPORT_host = '10.0.0.4'; +# $VARREPORT_port = '21'; +# $VARREPORT_user = 'cron'; +# $VARREPORT_pass = 'test'; +# $VARREPORT_dir = ''; + +$NODATEDIR = 0; # Don't use dated directories for audio +$YEARDIR = 1; # put dated directories in a year directory first + +if ($ftp_transfer > 0) + { + use Net::FTP; + + if (!$Q) {print "Sending File Over FTP: $outfile\n";} + $ftp = Net::FTP->new("$VARREPORT_host", Port => $VARREPORT_port, Debug => $DB); + $ftp->login("$VARREPORT_user","$VARREPORT_pass"); + $ftp->cwd("CALL_LOG"); + $ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile"); + $ftp->quit; + } + + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +if (!$Q) {print "CALLS EXPORT FOR $shipdate: $outfile\n";} +if (!$Q) {print "TOTAL CALLS: $TOTAL_SALES\n";} +if (!$Q) {print "script execution time in seconds: $secZ minutes: $secZm\n";} + +exit; + + + + + +### Subroutine for formatting of the output ### +sub select_format_loop + { + if ($output_format =~ /^pipe-basic$/) + { + $str = "$call_date|$phone_number|$vendor_id|$status|$user|$first_name|$last_name|$lead_id|$list_id|$campaign_id|$length_in_sec|$source_id|\n"; + } + + if ($output_format =~ /^tab-basic$/) + { + $str = "$call_date\t$phone_number\t$vendor_id\t$status\t$user\t$first_name\t$last_name\t$lead_id\t$list_id\t$campaign_id\t$length_in_sec\t$source_id\t\n"; + } + + + $Ealert .= "$str"; + + print out "$str"; + if ($DBX) {print "$str\n";} + + if ($DB > 0) + { + if ($rec_count =~ /10$/i) {print STDERR "0 $rec_count\r";} + if ($rec_count =~ /20$/i) {print STDERR "+ $rec_count\r";} + if ($rec_count =~ /30$/i) {print STDERR "| $rec_count\r";} + if ($rec_count =~ /40$/i) {print STDERR "\\ $rec_count\r";} + if ($rec_count =~ /50$/i) {print STDERR "- $rec_count\r";} + if ($rec_count =~ /60$/i) {print STDERR "/ $rec_count\r";} + if ($rec_count =~ /70$/i) {print STDERR "| $rec_count\r";} + if ($rec_count =~ /80$/i) {print STDERR "+ $rec_count\r";} + if ($rec_count =~ /90$/i) {print STDERR "0 $rec_count\r";} + if ($rec_count =~ /00$/i) {print "$rec_count|$TOTAL_SALES| |$phone_number|$call_date|\n";} + } + } + diff --git a/docs/CALLCARD.txt b/docs/CALLCARD.txt new file mode 100644 index 00000000..c9a27179 --- /dev/null +++ b/docs/CALLCARD.txt @@ -0,0 +1,87 @@ +Call Card featureset 2010-03-11 + +*** THIS SECTION OUTLINES THE NEW CALLCARD FEATURES in the 2.4 version *** + + +As of the 2.4 version we have added an optional callcard system to allow calls from customers to agents with timers and balances associated with card pin numbers. This is a highly customized system so it will take some work to get it running, it is not designed to work out of the box, but the framework is in place. + + + +# Calling Cards feature is used for ID numbers to be used for agent talk time. There are several applications for this including: paid support queues, chat lines, advisor services, financial advice, legal services. The system consists of an AGI script that takes calls in, asks for and validates the pin/status/balance and sends them to a defined in-group, then the deduction of time from the customer's account starts once the agent receives the call. Also, there will be an option for an alert to low balance injected into the calling session. + + + + + +Script involved in call card feature: +- agi-CALLCARD_dial_in.agi + + + +For the calls to be properly logged, use these settings(or add to existing URLs) in the in-group that is handling these calls: +- Start Call URL: "&minuteswarning=1&callcard=1" +- Dispo URL: "&callcard=--A--talk_time_min--B--" + + + + +Changes to database: +*** DO NOT MAKE THESE CHANGES, for documentation only *** + + +CREATE TABLE callcard_accounts ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +pin VARCHAR(10) NOT NULL, +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +inbound_group_id VARCHAR(20) default '', +index (pin) +); + +CREATE TABLE callcard_accounts_details ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +run VARCHAR(4) default '', +batch VARCHAR(5) default '', +pack VARCHAR(5) default '', +sequence VARCHAR(5) default '', +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +initial_value VARCHAR(6) default '0.00', +initial_minutes SMALLINT(5) default '3', +note_purchase_order VARCHAR(20) default '', +note_printer VARCHAR(20) default '', +note_did VARCHAR(18) default '', +inbound_group_id VARCHAR(20) default '', +note_language VARCHAR(10) default 'English', +note_name VARCHAR(20) default '', +note_comments VARCHAR(255) default '', +create_user VARCHAR(20) default '', +activate_user VARCHAR(20) default '', +used_user VARCHAR(20) default '', +void_user VARCHAR(20) default '', +create_time DATETIME, +activate_time DATETIME, +used_time DATETIME, +void_time DATETIME +); + +CREATE TABLE callcard_log ( +uniqueid VARCHAR(20) PRIMARY KEY NOT NULL, +card_id VARCHAR(20), +balance_minutes_start SMALLINT(5) default '3', +call_time DATETIME, +agent_time DATETIME, +dispo_time DATETIME, +agent VARCHAR(20) default '', +agent_dispo VARCHAR(6) default '', +agent_talk_sec MEDIUMINT(8) default '0', +agent_talk_min MEDIUMINT(8) default '0', +phone_number VARCHAR(18), +inbound_did VARCHAR(18), +index (card_id), +index (call_time) +); + +ALTER TABLE system_settings ADD callcard_enabled ENUM('1','0') default '0'; + +ALTER TABLE vicidial_users ADD callcard_admin ENUM('1','0') default '0'; diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 6c81cd1a..8b52f6ed 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -543,10 +543,10 @@ custom_three VARCHAR(100) default '', custom_four VARCHAR(100) default '', custom_five VARCHAR(100) default '', voicemail_id VARCHAR(10), -agent_call_log_view_override ENUM('DISABLED','Y','N') default 'DISABLED' +agent_call_log_view_override ENUM('DISABLED','Y','N') default 'DISABLED', +callcard_admin ENUM('1','0') default '0' ); - CREATE UNIQUE INDEX user ON vicidial_users (user); CREATE TABLE vicidial_user_log ( @@ -1214,7 +1214,8 @@ static_agent_url VARCHAR(255) default '', default_phone_code VARCHAR(8) default '1', enable_agc_dispo_log ENUM('0','1') default '0', custom_dialplan_entry TEXT, -queuemetrics_loginout ENUM('STANDARD','CALLBACK') default 'STANDARD' +queuemetrics_loginout ENUM('STANDARD','CALLBACK') default 'STANDARD', +callcard_enabled ENUM('1','0') default '0' ); CREATE TABLE vicidial_campaigns_list_mix ( @@ -1938,6 +1939,59 @@ index (state), index (areacode) ); +CREATE TABLE callcard_accounts ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +pin VARCHAR(10) NOT NULL, +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +inbound_group_id VARCHAR(20) default '', +index (pin) +); + +CREATE TABLE callcard_accounts_details ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +run VARCHAR(4) default '', +batch VARCHAR(5) default '', +pack VARCHAR(5) default '', +sequence VARCHAR(5) default '', +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +initial_value VARCHAR(6) default '0.00', +initial_minutes SMALLINT(5) default '3', +note_purchase_order VARCHAR(20) default '', +note_printer VARCHAR(20) default '', +note_did VARCHAR(18) default '', +inbound_group_id VARCHAR(20) default '', +note_language VARCHAR(10) default 'English', +note_name VARCHAR(20) default '', +note_comments VARCHAR(255) default '', +create_user VARCHAR(20) default '', +activate_user VARCHAR(20) default '', +used_user VARCHAR(20) default '', +void_user VARCHAR(20) default '', +create_time DATETIME, +activate_time DATETIME, +used_time DATETIME, +void_time DATETIME +); + +CREATE TABLE callcard_log ( +uniqueid VARCHAR(20) PRIMARY KEY NOT NULL, +card_id VARCHAR(20), +balance_minutes_start SMALLINT(5) default '3', +call_time DATETIME, +agent_time DATETIME, +dispo_time DATETIME, +agent VARCHAR(20) default '', +agent_dispo VARCHAR(6) default '', +agent_talk_sec MEDIUMINT(8) default '0', +agent_talk_min MEDIUMINT(8) default '0', +phone_number VARCHAR(18), +inbound_did VARCHAR(18), +index (card_id), +index (call_time) +); + ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; @@ -2077,7 +2131,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; -UPDATE system_settings SET db_schema_version='1205',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1206',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index d6181216..99dff187 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -98,3 +98,62 @@ UPDATE system_settings SET db_schema_version='1204',db_schema_update_date=NOW(); ALTER TABLE system_settings ADD queuemetrics_loginout ENUM('STANDARD','CALLBACK') default 'STANDARD'; UPDATE system_settings SET db_schema_version='1205',db_schema_update_date=NOW(); + +CREATE TABLE callcard_accounts ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +pin VARCHAR(10) NOT NULL, +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +inbound_group_id VARCHAR(20) default '', +index (pin) +); + +CREATE TABLE callcard_accounts_details ( +card_id VARCHAR(20) PRIMARY KEY NOT NULL, +run VARCHAR(4) default '', +batch VARCHAR(5) default '', +pack VARCHAR(5) default '', +sequence VARCHAR(5) default '', +status ENUM('GENERATE','PRINT','SHIP','HOLD','ACTIVE','USED','EMPTY','CANCEL','VOID') default 'GENERATE', +balance_minutes SMALLINT(5) default '3', +initial_value VARCHAR(6) default '0.00', +initial_minutes SMALLINT(5) default '3', +note_purchase_order VARCHAR(20) default '', +note_printer VARCHAR(20) default '', +note_did VARCHAR(18) default '', +inbound_group_id VARCHAR(20) default '', +note_language VARCHAR(10) default 'English', +note_name VARCHAR(20) default '', +note_comments VARCHAR(255) default '', +create_user VARCHAR(20) default '', +activate_user VARCHAR(20) default '', +used_user VARCHAR(20) default '', +void_user VARCHAR(20) default '', +create_time DATETIME, +activate_time DATETIME, +used_time DATETIME, +void_time DATETIME +); + +CREATE TABLE callcard_log ( +uniqueid VARCHAR(20) PRIMARY KEY NOT NULL, +card_id VARCHAR(20), +balance_minutes_start SMALLINT(5) default '3', +call_time DATETIME, +agent_time DATETIME, +dispo_time DATETIME, +agent VARCHAR(20) default '', +agent_dispo VARCHAR(6) default '', +agent_talk_sec MEDIUMINT(8) default '0', +agent_talk_min MEDIUMINT(8) default '0', +phone_number VARCHAR(18), +inbound_did VARCHAR(18), +index (card_id), +index (call_time) +); + +ALTER TABLE system_settings ADD callcard_enabled ENUM('1','0') default '0'; + +ALTER TABLE vicidial_users ADD callcard_admin ENUM('1','0') default '0'; + +UPDATE system_settings SET db_schema_version='1206',db_schema_update_date=NOW(); diff --git a/sounds/0_es.gsm b/sounds/0_es.gsm new file mode 100644 index 00000000..2f88c989 Binary files /dev/null and b/sounds/0_es.gsm differ diff --git a/sounds/100_es.gsm b/sounds/100_es.gsm new file mode 100644 index 00000000..da12a371 Binary files /dev/null and b/sounds/100_es.gsm differ diff --git a/sounds/10_es.gsm b/sounds/10_es.gsm new file mode 100644 index 00000000..366c1c76 Binary files /dev/null and b/sounds/10_es.gsm differ diff --git a/sounds/11_es.gsm b/sounds/11_es.gsm new file mode 100644 index 00000000..bf93427d Binary files /dev/null and b/sounds/11_es.gsm differ diff --git a/sounds/12_es.gsm b/sounds/12_es.gsm new file mode 100644 index 00000000..ab84676c Binary files /dev/null and b/sounds/12_es.gsm differ diff --git a/sounds/13_es.gsm b/sounds/13_es.gsm new file mode 100644 index 00000000..7aa418d4 Binary files /dev/null and b/sounds/13_es.gsm differ diff --git a/sounds/14_es.gsm b/sounds/14_es.gsm new file mode 100644 index 00000000..e8d45545 --- /dev/null +++ b/sounds/14_es.gsm @@ -0,0 +1,5 @@ +*REP3$Z%S}:,faAU}$kZs+hflS-6OYnuS a]V-EaŪãnYiU$nL4+Z$llIɕtDtR9 cH`J)"FgG#ZY㖁#[Tk{MA mXٮs@ؿќƁc[9=ʡW$Z tٯ !W§X &7wl>9׶ZSl,+y' M:_mSkq!Xb:+vo/I-mlWSUI[n&Ӂ;q$\es I|ɋ+6ڒ\*Gg8m;,|_R9&n9#f6"f +'goH]BA#SIT\S2B+G!.ТFt*SE`EbQVQ̡gDnغs ZdRO[na8- Bwa%] Hde&ę`\"9=/l + UA6lQa)#v7mVE0um]Gݗl8ܿ/RDۄL$$eR̶o9g.)Yy$#h:QHMҘ*V}&2ҤGYZN #R>dEl~IVHlZLtڃg&kӒeajAԥl8uų=,\lX*I[S~TZ܇(D Z̈Ǽ:bH# +(bɔ8ɅPE;b/fPU +`C:h(;!dZ7G֏'|caf4Ly,BBd<­;[ӄrJ{C4qiUBY{έ+"oGlkCp\d7eܔ\lq࢘5KCԢG&MXc$GFXTD֠4Sc⦓.rc8ۙdRKeJ!,cѡ&/ +T8akLZZnqS"׬2][#5\>cXA™ N]b6麸Ъkn::XIDQ܊Eł6$+ 3Yhc\b7HٮtUbX_VhysIw_ٱ˅ F.@ǖik֥2EWPI.mq!rj֑A)ԫvᮥlcpٱՋSI^K8y;tԠ'!HEʡhU$p&TmRS-܁! d)XV(ٲF䌮rqq(q8qġ3Pr&ciZCZ*]՟΁ Vխn$6T H,Q \ No newline at end of file diff --git a/sounds/15_es.gsm b/sounds/15_es.gsm new file mode 100644 index 00000000..e7fb94a1 --- /dev/null +++ b/sounds/15_es.gsm @@ -0,0 +1,3 @@ +اRłP#w+7%``4k /4C+تZARIQZt|ֈۑWd\WU%,Z5>J!ƲA5SJڥSnBAW5=z[K̶EsEz3],Zu9k@s-kjŁh4U[A-!d\GjVr*Qá`ޭQ:աĩE,!y+تr3VcAœ<#XK#cۤXXK*uUqm(89\b>WLP + Δi٭_h\An[{$KSy%mrĄ4ᰡQ"RҢ-4*amKaf&%[!y`qp"Nv׶SzZ‘!m C &tիaDMa,r+0Zy؁Jr0T8"eb6 ح!0+koU,6W#B wUʓ+AX@"J҈ %QI$ \ No newline at end of file diff --git a/sounds/16_es.gsm b/sounds/16_es.gsm new file mode 100644 index 00000000..db61e0eb Binary files /dev/null and b/sounds/16_es.gsm differ diff --git a/sounds/17_es.gsm b/sounds/17_es.gsm new file mode 100644 index 00000000..18e16507 Binary files /dev/null and b/sounds/17_es.gsm differ diff --git a/sounds/18_es.gsm b/sounds/18_es.gsm new file mode 100644 index 00000000..8fbe5aea Binary files /dev/null and b/sounds/18_es.gsm differ diff --git a/sounds/19_es.gsm b/sounds/19_es.gsm new file mode 100644 index 00000000..7ee88cb6 Binary files /dev/null and b/sounds/19_es.gsm differ diff --git a/sounds/1_es.gsm b/sounds/1_es.gsm new file mode 100644 index 00000000..fc5927c4 Binary files /dev/null and b/sounds/1_es.gsm differ diff --git a/sounds/1a_es.gsm b/sounds/1a_es.gsm new file mode 100644 index 00000000..e3297fcd Binary files /dev/null and b/sounds/1a_es.gsm differ diff --git a/sounds/200_es.gsm b/sounds/200_es.gsm new file mode 100644 index 00000000..967fd922 Binary files /dev/null and b/sounds/200_es.gsm differ diff --git a/sounds/20_es.gsm b/sounds/20_es.gsm new file mode 100644 index 00000000..56ed2bb4 Binary files /dev/null and b/sounds/20_es.gsm differ diff --git a/sounds/21_es.gsm b/sounds/21_es.gsm new file mode 100644 index 00000000..767ee681 Binary files /dev/null and b/sounds/21_es.gsm differ diff --git a/sounds/22_es.gsm b/sounds/22_es.gsm new file mode 100644 index 00000000..b34218f4 Binary files /dev/null and b/sounds/22_es.gsm differ diff --git a/sounds/23_es.gsm b/sounds/23_es.gsm new file mode 100644 index 00000000..8746436c Binary files /dev/null and b/sounds/23_es.gsm differ diff --git a/sounds/24_es.gsm b/sounds/24_es.gsm new file mode 100644 index 00000000..6cd6344c Binary files /dev/null and b/sounds/24_es.gsm differ diff --git a/sounds/25_es.gsm b/sounds/25_es.gsm new file mode 100644 index 00000000..130cd770 Binary files /dev/null and b/sounds/25_es.gsm differ diff --git a/sounds/26_es.gsm b/sounds/26_es.gsm new file mode 100644 index 00000000..fc1e9750 Binary files /dev/null and b/sounds/26_es.gsm differ diff --git a/sounds/27_es.gsm b/sounds/27_es.gsm new file mode 100644 index 00000000..dd9a34e2 Binary files /dev/null and b/sounds/27_es.gsm differ diff --git a/sounds/28_es.gsm b/sounds/28_es.gsm new file mode 100644 index 00000000..49ef3d52 Binary files /dev/null and b/sounds/28_es.gsm differ diff --git a/sounds/29_es.gsm b/sounds/29_es.gsm new file mode 100644 index 00000000..b17fcd9e Binary files /dev/null and b/sounds/29_es.gsm differ diff --git a/sounds/2_es.gsm b/sounds/2_es.gsm new file mode 100644 index 00000000..827939b4 Binary files /dev/null and b/sounds/2_es.gsm differ diff --git a/sounds/300_es.gsm b/sounds/300_es.gsm new file mode 100644 index 00000000..e95f308c Binary files /dev/null and b/sounds/300_es.gsm differ diff --git a/sounds/30_es.gsm b/sounds/30_es.gsm new file mode 100644 index 00000000..5d08a593 Binary files /dev/null and b/sounds/30_es.gsm differ diff --git a/sounds/3_es.gsm b/sounds/3_es.gsm new file mode 100644 index 00000000..d2a5f80a Binary files /dev/null and b/sounds/3_es.gsm differ diff --git a/sounds/400_es.gsm b/sounds/400_es.gsm new file mode 100644 index 00000000..76b1abf0 Binary files /dev/null and b/sounds/400_es.gsm differ diff --git a/sounds/40_es.gsm b/sounds/40_es.gsm new file mode 100644 index 00000000..90741f8a Binary files /dev/null and b/sounds/40_es.gsm differ diff --git a/sounds/4_es.gsm b/sounds/4_es.gsm new file mode 100644 index 00000000..2d894eb3 Binary files /dev/null and b/sounds/4_es.gsm differ diff --git a/sounds/500_es.gsm b/sounds/500_es.gsm new file mode 100644 index 00000000..41bde6c6 Binary files /dev/null and b/sounds/500_es.gsm differ diff --git a/sounds/50_es.gsm b/sounds/50_es.gsm new file mode 100644 index 00000000..4f6cb05d Binary files /dev/null and b/sounds/50_es.gsm differ diff --git a/sounds/5_es.gsm b/sounds/5_es.gsm new file mode 100644 index 00000000..20276b50 Binary files /dev/null and b/sounds/5_es.gsm differ diff --git a/sounds/600_es.gsm b/sounds/600_es.gsm new file mode 100644 index 00000000..0dca9346 Binary files /dev/null and b/sounds/600_es.gsm differ diff --git a/sounds/60_es.gsm b/sounds/60_es.gsm new file mode 100644 index 00000000..5221b379 Binary files /dev/null and b/sounds/60_es.gsm differ diff --git a/sounds/6_es.gsm b/sounds/6_es.gsm new file mode 100644 index 00000000..81876dc8 Binary files /dev/null and b/sounds/6_es.gsm differ diff --git a/sounds/700_es.gsm b/sounds/700_es.gsm new file mode 100644 index 00000000..23c85e2d Binary files /dev/null and b/sounds/700_es.gsm differ diff --git a/sounds/70_es.gsm b/sounds/70_es.gsm new file mode 100644 index 00000000..dbb08049 Binary files /dev/null and b/sounds/70_es.gsm differ diff --git a/sounds/7_es.gsm b/sounds/7_es.gsm new file mode 100644 index 00000000..4f46ecb3 Binary files /dev/null and b/sounds/7_es.gsm differ diff --git a/sounds/800_es.gsm b/sounds/800_es.gsm new file mode 100644 index 00000000..e08a177d Binary files /dev/null and b/sounds/800_es.gsm differ diff --git a/sounds/80_es.gsm b/sounds/80_es.gsm new file mode 100644 index 00000000..40569bb2 Binary files /dev/null and b/sounds/80_es.gsm differ diff --git a/sounds/8_es.gsm b/sounds/8_es.gsm new file mode 100644 index 00000000..a78c4db2 Binary files /dev/null and b/sounds/8_es.gsm differ diff --git a/sounds/900_es.gsm b/sounds/900_es.gsm new file mode 100644 index 00000000..7f63b46b Binary files /dev/null and b/sounds/900_es.gsm differ diff --git a/sounds/90_es.gsm b/sounds/90_es.gsm new file mode 100644 index 00000000..c28affe9 Binary files /dev/null and b/sounds/90_es.gsm differ diff --git a/sounds/9_es.gsm b/sounds/9_es.gsm new file mode 100644 index 00000000..90210aec Binary files /dev/null and b/sounds/9_es.gsm differ diff --git a/sounds/a-m_es.gsm b/sounds/a-m_es.gsm new file mode 100644 index 00000000..f8765d65 Binary files /dev/null and b/sounds/a-m_es.gsm differ diff --git a/sounds/callcard_minutes_left.gsm b/sounds/callcard_minutes_left.gsm new file mode 100644 index 00000000..59c2fdf1 Binary files /dev/null and b/sounds/callcard_minutes_left.gsm differ diff --git a/sounds/callcard_minutes_left_es.wav b/sounds/callcard_minutes_left_es.wav new file mode 100644 index 00000000..d821bc5e Binary files /dev/null and b/sounds/callcard_minutes_left_es.wav differ diff --git a/sounds/callcard_pin_enter.gsm b/sounds/callcard_pin_enter.gsm new file mode 100644 index 00000000..b63b882c Binary files /dev/null and b/sounds/callcard_pin_enter.gsm differ diff --git a/sounds/callcard_pin_enter_es.wav b/sounds/callcard_pin_enter_es.wav new file mode 100644 index 00000000..df7dfaa2 Binary files /dev/null and b/sounds/callcard_pin_enter_es.wav differ diff --git a/sounds/callcard_pin_invalid.gsm b/sounds/callcard_pin_invalid.gsm new file mode 100644 index 00000000..821890f1 Binary files /dev/null and b/sounds/callcard_pin_invalid.gsm differ diff --git a/sounds/callcard_pin_invalid_es.wav b/sounds/callcard_pin_invalid_es.wav new file mode 100644 index 00000000..4cf1ec2f Binary files /dev/null and b/sounds/callcard_pin_invalid_es.wav differ diff --git a/sounds/cien_es.gsm b/sounds/cien_es.gsm new file mode 100644 index 00000000..1d472710 Binary files /dev/null and b/sounds/cien_es.gsm differ diff --git a/sounds/dolar_es.gsm b/sounds/dolar_es.gsm new file mode 100644 index 00000000..848c6b58 Binary files /dev/null and b/sounds/dolar_es.gsm differ diff --git a/sounds/dollars_es.gsm b/sounds/dollars_es.gsm new file mode 100644 index 00000000..28970ce3 Binary files /dev/null and b/sounds/dollars_es.gsm differ diff --git a/sounds/mil_es.gsm b/sounds/mil_es.gsm new file mode 100644 index 00000000..06df3e9e Binary files /dev/null and b/sounds/mil_es.gsm differ diff --git a/sounds/millon_es.gsm b/sounds/millon_es.gsm new file mode 100644 index 00000000..d6529484 Binary files /dev/null and b/sounds/millon_es.gsm differ diff --git a/sounds/millones_es.gsm b/sounds/millones_es.gsm new file mode 100644 index 00000000..0395a93e Binary files /dev/null and b/sounds/millones_es.gsm differ diff --git a/sounds/one_minute_warning_es.wav b/sounds/one_minute_warning_es.wav new file mode 100644 index 00000000..6b5665e8 Binary files /dev/null and b/sounds/one_minute_warning_es.wav differ diff --git a/sounds/p-m_es.gsm b/sounds/p-m_es.gsm new file mode 100644 index 00000000..22a0d5e6 Binary files /dev/null and b/sounds/p-m_es.gsm differ diff --git a/sounds/peso_es.gsm b/sounds/peso_es.gsm new file mode 100644 index 00000000..589b77f6 Binary files /dev/null and b/sounds/peso_es.gsm differ diff --git a/sounds/pesos_es.gsm b/sounds/pesos_es.gsm new file mode 100644 index 00000000..d3e6070e Binary files /dev/null and b/sounds/pesos_es.gsm differ diff --git a/sounds/vm-youhave_es.wav b/sounds/vm-youhave_es.wav new file mode 100644 index 00000000..fd45ee88 Binary files /dev/null and b/sounds/vm-youhave_es.wav differ diff --git a/sounds/y_es.gsm b/sounds/y_es.gsm new file mode 100644 index 00000000..4b95033a Binary files /dev/null and b/sounds/y_es.gsm differ diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 0de8d83c..531c0e72 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -40,6 +40,9 @@ Scheduled Callbacks Alert|| This option allows the callbacks status line in the agent interface to be red, blink or blink red when there are AGENTONLY scheduled callbacks that have hit their trigger time and date. Default is NONE for standard status line|| QueueMetrics Login-Out|| This option affects how vicidial will log the logins and logouts of an agent in the queue_log. Default is STANDARD to use standard AGENTLOGIN AGENTLOGOFF, CALLBACK will use AGENTCALLBACKLOGIN and AGENTCALLBACKLOGOFF that QM will parse differently|| +Enable CallCard|| +This setting enables the CallCard features with ViciDial to allow for callers to use pin numbers and card_ids that have a balance of minutes and those balances can have agent talk time on customer calls to in-groups deducted. Default is 0 for disabled|| +CallCard Access|| ############################################################ CLIENT diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 071cf2ab..f21535cc 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -240,12 +240,13 @@ # 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection # 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions # -$version = '2.4-147'; -$build = '100309-0535'; +$version = '2.4-148'; +$build = '100311-1559'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=314; +$mysql_log_count=321; $one_mysql_log=0; require("dbconnect.php"); @@ -4501,6 +4502,7 @@ if ($ACTION == 'VDADcheckINCOMING') if ($DB > 0) {echo "$SCUfile[0]
\n";} ##### BEGIN special filtering and response for Vtiger account balance function ##### + # http://vtiger/vicidial/api.php?mode=callxfer&contactwsid=--A--vendor_lead_code--B--&minuteswarning=3 $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00294',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4510,27 +4512,57 @@ if ($ACTION == 'VDADcheckINCOMING') $row=mysql_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } - if ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) + if ( ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { $SCUoutput=''; foreach ($SCUfile as $SCUline) {$SCUoutput .= "$SCUline";} # {"result":true,"durationLimit":3071} - if (strlen($SCUoutput) > 4) + if ( (strlen($SCUoutput) > 4) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { - $SCUresponse = explode('durationLimit',$SCUoutput); - $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); - $durationLimitSEC = ( ( ($durationLimit + 0) - 3) * 60); # minutes - 3 for 3-minute-warning + $minuteswarning=3; # default to 3 + if (preg_match("/minuteswarning/",$VDCL_start_call_url)) + { + $minuteswarningARY = explode('minuteswarning=',$VDCL_start_call_url); + $minuteswarning = preg_replace('/&.*/','',$minuteswarningARY[1]); + } + ### add this to the Start Call URL for callcard calls to be logged "&minuteswarning=1&callcard=1" + if (preg_match("/callcard=/",$VDCL_start_call_url)) + { + $stmt="SELECT balance_minutes_start FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00315',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $durationLimit = $row[0]; + + $stmt="UPDATE callcard_log set agent_time='$NOW_TIME',agent='$user' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00316',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + } + } + else + { + $SCUresponse = explode('durationLimit',$SCUoutput); + $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); + } + if (strlen($durationLimit) < 1) {$durationLimit = 0;} + $durationLimitSEC = ( ( ($durationLimit + 0) - $minuteswarning) * 60); # minutes - 3 for 3-minute-warning if ($durationLimitSEC < 5) {$durationLimitSEC = 5;} - $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='3 minute warning for customer',external_timer_action_seconds='$durationLimitSEC' where user='$user';"; + $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='$minuteswarning minute warning for customer',external_timer_action_seconds='$durationLimitSEC' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00295',$user,$server_ip,$session_name,$one_mysql_log);} $vla_update_timer = mysql_affected_rows($link); $fp = fopen ("./call_url_log.txt", "a"); - fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer\n"); + fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer|$minuteswarning|$uniqueid|\n"); fclose($fp); } } @@ -5626,8 +5658,10 @@ if ($ACTION == 'updateDISPO') mysql_close($linkB); } - - ### Issue Dispo Call URL if defined + + ############################################ + ### BEGIN Issue Dispo Call URL if defined + ############################################ if (strlen($dispo_call_url) > 7) { $talk_time=0; @@ -5837,7 +5871,51 @@ if ($ACTION == 'updateDISPO') fwrite ($fp, "$dispo_call_url\n$SCUoutput\n"); fclose($fp); } + + ### add this to the Dispo URL for callcard calls to be logged "&callcard=--A--talk_time_min--B--" + if (preg_match("/callcard/",$dispo_call_url)) + { + $stmt="SELECT balance_minutes_start,card_id FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00317',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + $fp = fopen ("./call_url_log.txt", "a"); + fwrite ($fp, "$dispo_call_url\n$stmt|$bms_ct\n"); + fclose($fp); + + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $balance_minutes_start = $row[0]; + $card_id = $row[1]; + + $current_minutes = ($balance_minutes_start - $talk_time_min); + + $stmt="UPDATE callcard_log set agent_talk_sec='$talk_time',agent_talk_min='$talk_time_min',dispo_time='$NOW_TIME',agent_dispo='$dispo' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00318',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00319',$user,$server_ip,$session_name,$one_mysql_log);} + $cca_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts_details set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00320',$user,$server_ip,$session_name,$one_mysql_log);} + $ccad_update = mysql_affected_rows($link); + } + } } + ############################################ + ### END Issue Dispo Call URL if defined + ############################################ + ##### check if system is set to generate logfile for dispos $stmt="SELECT enable_agc_dispo_log FROM system_settings;"; @@ -6981,7 +7059,7 @@ if ($ACTION == 'CALLSINQUEUEgrab') $stmtD="SELECT * from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmtD, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00321',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$DEBUGvac_count = mysql_num_rows($rslt);} if ($DEBUGvac_count > 0) { diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index c5cbb737..585e25d8 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -2837,6 +2837,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var pause_code_counter=1; var agent_call_log_view=''; var scheduled_callbacks_alert=''; + var last_uniqueid=''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -4777,6 +4778,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} custchannellive=1; document.vicidial_form.uniqueid.value = MDlookResponse_array[0]; + last_uniqueid = MDlookResponse_array[0]; document.vicidial_form.callchannel.value = MDlookResponse_array[1]; lastcustchannel = MDlookResponse_array[1]; if( document.images ) { document.images['livecall'].src = image_livecall_ON.src;} @@ -6553,6 +6555,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.lead_id.value = VDIC_data_VDAC[0]; document.vicidial_form.uniqueid.value = VDIC_data_VDAC[1]; + last_uniqueid = VDIC_data_VDAC[1]; CIDcheck = VDIC_data_VDAC[2]; CalLCID = VDIC_data_VDAC[2]; document.vicidial_form.callchannel.value = VDIC_data_VDAC[3]; @@ -8087,7 +8090,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&comments=" + CallBackCommenTs; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + last_uniqueid + "&comments=" + CallBackCommenTs; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 99262577..87411da3 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1195,6 +1195,10 @@ if (isset($_GET["scheduled_callbacks_alert"])) {$scheduled_callbacks_alert=$_G elseif (isset($_POST["scheduled_callbacks_alert"])) {$scheduled_callbacks_alert=$_POST["scheduled_callbacks_alert"];} if (isset($_GET["queuemetrics_loginout"])) {$queuemetrics_loginout=$_GET["queuemetrics_loginout"];} elseif (isset($_POST["queuemetrics_loginout"])) {$queuemetrics_loginout=$_POST["queuemetrics_loginout"];} +if (isset($_GET["callcard_enabled"])) {$callcard_enabled=$_GET["callcard_enabled"];} + elseif (isset($_POST["callcard_enabled"])) {$callcard_enabled=$_POST["callcard_enabled"];} +if (isset($_GET["callcard_admin"])) {$callcard_admin=$_GET["callcard_admin"];} + elseif (isset($_POST["callcard_admin"])) {$callcard_admin=$_POST["callcard_admin"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1398,6 +1402,8 @@ if ($non_latin < 1) $default_external_server_ip = ereg_replace("[^0-9]","",$default_external_server_ip); $enable_agc_xfer_log = ereg_replace("[^0-9]","",$enable_agc_xfer_log); $enable_agc_dispo_log = ereg_replace("[^0-9]","",$enable_agc_dispo_log); + $callcard_enabled = ereg_replace("[^0-9]","",$callcard_enabled); + $callcard_admin = ereg_replace("[^0-9]","",$callcard_admin); $drop_call_seconds = ereg_replace("[^-0-9]","",$drop_call_seconds); @@ -2098,11 +2104,12 @@ else # 100221-0924 - Added Custom CallerID capability in Campaign settings # 100302-2133 - Added Scheduled Callbacks Alert option # 100309-0510 - Added queuemetrics_loginout option +# 100311-2348 - Added CallCard links and settings # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-243'; -$build = '100309-0510'; +$admin_version = '2.4-244'; +$build = '100311-2348'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -2192,7 +2199,7 @@ else { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $LOGfull_name =$row[3]; @@ -2228,6 +2235,7 @@ else $LOGmanager_shift_enforcement_override=$row[61]; $LOGexport_reports =$row[64]; $LOGdelete_from_dnc =$row[65]; + $LOGcallcard_admin =$row[66]; $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; $rslt=mysql_query($stmt, $link); @@ -6040,6 +6048,11 @@ if ($ADD==99999)
Enable TTS Integration - This setting allows you to enable Text To Speech integration with Cepstral. This is currently only available for outbound Survey type campaigns. Default is 0 for disabled. +
+ +
+ Enable CallCard - This setting enables the CallCard features with ViciDial to allow for callers to use pin numbers and card_ids that have a balance of minutes and those balances can have agent talk time on customer calls to in-groups deducted. Default is 0 for disabled. +

@@ -8491,7 +8504,7 @@ if ($ADD=="2A") $stmt="UPDATE system_settings SET auto_user_add_value='$user';"; $rslt=mysql_query($stmt, $link); } - $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override from vicidial_users where user=\"$source_user_id\";"; + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin from vicidial_users where user=\"$source_user_id\";"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; @@ -10620,7 +10633,7 @@ if ($ADD=="4A") } 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',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override' where user='$user';"; + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',callcard_admin='$callcard_admin' where user='$user';"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -13541,7 +13554,7 @@ if ($ADD==411111111111111) echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; - $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout';"; + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled';"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -15801,7 +15814,7 @@ if ($ADD==3) echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -22498,7 +22513,7 @@ if ($ADD==311111111111111) echo "
\n"; echo ""; - $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override from vicidial_users where user='$user';"; + $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin from vicidial_users where user='$user';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $user_id = $row[0]; @@ -15880,6 +15893,7 @@ if ($ADD==3) $user_custom_five = $row[75]; $voicemail_id = $row[76]; $agent_call_log_view_override = $row[77]; + $callcard_admin = $row[78]; if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) { @@ -16054,6 +16068,7 @@ if ($ADD==3) echo "
Modify Call Times: $NWB#vicidial_users-modify_call_times$NWE
Delete Call Times: $NWB#vicidial_users-delete_call_times$NWE
Modify Servers: $NWB#vicidial_users-modify_sections$NWE
CallCard Access: $NWB#vicidial_users-modify_sections$NWE
Agent API Access: $NWB#vicidial_users-vdc_agent_api_access$NWE
Add Timeclock Log Record: $NWB#vicidial_users-add_timeclock_log$NWE
\n"; + echo "\n"; + if ($SSallow_custom_dialplan > 0) { echo "\n"; diff --git a/www/vicidial/admin_header.php b/www/vicidial/admin_header.php index 1391c159..1a00b5b7 100644 --- a/www/vicidial/admin_header.php +++ b/www/vicidial/admin_header.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES @@ -18,6 +18,7 @@ # 90904-1534 - Added launch_moh_chooser # 90916-2334 - Added Voicemail options # 91223-1030 - Added VIDPROMPT options for in-group routing in Call Menus +# 100311-2210 - Added callcard_enabled Admin element # @@ -896,11 +897,12 @@ echo "\n"; echo "\n"; echo "\n"; -$stmt="SELECT admin_home_url,enable_tts_integration from system_settings;"; +$stmt="SELECT admin_home_url,enable_tts_integration,callcard_enabled from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); -$admin_home_url_LU = $row[0]; +$admin_home_url_LU = $row[0]; $SSenable_tts_integration = $row[1]; +$SScallcard_enabled = $row[2]; ?>
@@ -1145,6 +1147,8 @@ $SSenable_tts_integration = $row[1]; else {$vm_sh=''; $vm_fc='BLACK';} if ($sh=='tts') {$tts_sh="bgcolor=\"$tts_color\""; $tts_fc="$tts_font";} else {$tts_sh=''; $tts_fc='BLACK';} + if ($sh=='cc') {$cc_sh="bgcolor=\"$cc_color\""; $cc_fc="$cc_font";} + else {$cc_sh=''; $cc_fc='BLACK';} ?>
> @@ -1185,6 +1189,13 @@ $SSenable_tts_integration = $row[1]; SIZE=> Text To Speech + 0) + { ?> + > + + @@ -1251,6 +1262,10 @@ $SSenable_tts_integration = $row[1]; ?> > 1) and (strlen($admin_hh) > 1) ) { + ?> + > + 1) and (strlen($admin_hh) > 1) ) { ?> > diff --git a/www/vicidial/callcard_admin.php b/www/vicidial/callcard_admin.php new file mode 100644 index 00000000..71d47869 --- /dev/null +++ b/www/vicidial/callcard_admin.php @@ -0,0 +1,898 @@ + LICENSE: AGPLv2 +# +# This callcard script is to administer the callcard accounts in ViciDial +# it is separate from the standard admin.php script. callcard_enabled in +# the system_settings table must be active for this script to work. +# +# CHANGES +# 100311-2325 - first build +# + +$version = '2.4-1'; +$build = '100311-2325'; + +$MT[0]=''; + +require("dbconnect.php"); + +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["action"])) {$action=$_GET["action"];} + elseif (isset($_POST["action"])) {$action=$_POST["action"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["run"])) {$run=$_GET["run"];} + elseif (isset($_POST["run"])) {$run=$_POST["run"];} +if (isset($_GET["batch"])) {$batch=$_GET["batch"];} + elseif (isset($_POST["batch"])) {$batch=$_POST["batch"];} +if (isset($_GET["pack"])) {$pack=$_GET["pack"];} + elseif (isset($_POST["pack"])) {$pack=$_POST["pack"];} +if (isset($_GET["sequence"])) {$sequence=$_GET["sequence"];} + elseif (isset($_POST["sequence"])) {$sequence=$_POST["sequence"];} +if (isset($_GET["card_id"])) {$card_id=$_GET["card_id"];} + elseif (isset($_POST["card_id"])) {$card_id=$_POST["card_id"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + + +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 + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,callcard_enabled FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$ss_conf_ct = mysql_num_rows($rslt); +if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $callcard_enabled = $row[1]; + } +##### END SETTINGS LOOKUP ##### +########################################### + + +if ($callcard_enabled < 1) + { + echo "ERROR: CallCard is not active on this system\n"; + exit; + } + +if ($non_latin < 1) + { + ### Clean Variable Values ### + $DB = ereg_replace("[^0-9]","",$DB); + $action = ereg_replace("[^\_0-9a-zA-Z]","",$action); + $card_id = ereg_replace("[^-\_0-9]","",$card_id); + $run = ereg_replace("[^0-9]","",$run); + $batch = ereg_replace("[^0-9]","",$batch); + $pack = ereg_replace("[^0-9]","",$pack); + $sequence = ereg_replace("[^0-9]","",$sequence); + $territory_description = ereg_replace("[^ -\_\.\,0-9a-zA-Z]","",$territory_description); + $user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); + $old_territory = ereg_replace("[^-\_0-9a-zA-Z]","",$old_territory); + $old_user = ereg_replace("[^-\_0-9a-zA-Z]","",$old_user); + $accountid = ereg_replace("[^-\_0-9a-zA-Z]","",$accountid); + } + +if (eregi("YES",$batch)) + { + $USER='batch'; + $PASS='batch'; + } +else + { + $USER=$_SERVER['PHP_AUTH_USER']; + $PASS=$_SERVER['PHP_AUTH_PW']; + $USER = ereg_replace("[^0-9a-zA-Z]","",$USER); + $PASS = ereg_replace("[^0-9a-zA-Z]","",$PASS); + + $stmt="SELECT count(*) from vicidial_users where user='$USER' and pass='$PASS' and user_level > 7 and callcard_admin='1'"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($USER)<2) or (strlen($PASS)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$USER|$PASS|\n"; + exit; + } + } + + +if (strlen($action) < 1) + {$action = 'CALLCARD_SUMMARY';} + + + +?> + + + + +ADMINISTRATION: CallCard Admin +<?php + + + + + + +### BEGIN change territory owner for one account +if ( ($action == "CHANGE_TERRITORY_OWNER_ACCOUNT") and ($enable_vtiger_integration > 0) ) + { + echo "\n"; + echo "
\n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -22552,6 +22567,7 @@ if ($ADD==311111111111111) $enable_agc_dispo_log = $row[48]; $custom_dialplan_entry = $row[49]; $queuemetrics_loginout = $row[50]; + $callcard_enabled = $row[51]; echo "
MODIFY VICIDIAL SYSTEM SETTINGS
\n"; echo "\n"; @@ -22699,6 +22715,8 @@ if ($ADD==311111111111111) echo "
Enable TTS Integration: $NWB#settings-enable_tts_integration$NWE
Enable CallCard: $NWB#settings-callcard_enabled$NWE
Custom Dialplan Entry: $NWB#settings-custom_dialplan_entry$NWE
>   + SIZE=> CallCard Admin
  > Show TTS Entries   |   > Add A New TTS Entry
  > CallCard Summary   |   > CallCard Batches   |   > CallCard Search
  > Show MOH Entries   |   > Add A New MOH Entry
\n"; + echo ""; + + echo "
Vtiger Change Territory Owner\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Account ID:
New Owner:
Update ViciDial List Owner:
\n"; + exit; + } +### END change territory owner for one account + + + +##### BEGIN Set variables to make header show properly ##### +$ADD = '0'; +$hh = 'admin'; +$sh = 'cc'; +$LOGast_admin_access = '1'; +$ADMIN = 'admin.php'; +$page_width='770'; +$section_width='750'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$admin_color = '#FFFF99'; +$admin_font = 'BLACK'; +$admin_color = '#E6E6E6'; +$cc_color = '#FFFF99'; +$cc_font = 'BLACK'; +$cc_color = '#C6C6C6'; +$subcamp_color = '#C6C6C6'; +##### END Set variables to make header show properly ##### +; +require("admin_header.php"); + +$colspan='3'; + +?> + BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0> + +
  \n"; + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ip = getenv("REMOTE_ADDR"); +$date = date("r"); +$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://';} +$admDIR = "$HTTPprotocol$server_name:$server_port$script_name"; +$admDIR = eregi_replace('audio_store.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +$secX = date("U"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + + + + + +### BEGIN change territory owner in the system +if ( ($action == "CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integration > 0) ) + { + echo "
\n"; + echo ""; + + echo "
Vtiger Change Territory Owner\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Territory:
New Owner:
Update ViciDial List Owner:
\n"; + } +### END change territory owner in the system + + +### BEGIN delete user territory page +if ($action == "DELETE_USER_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($user)<1) ) + { + echo "ERROR: Territory and User must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 0) + { + echo "ERROR: this territory user is not in the system
\n"; + } + else + { + $stmt="DELETE from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "User Territory Deleted: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$USER', ip_address='$ip', event_section='TERRITORIES', event_type='DELETE', record_id='$territory', event_code='ADMIN DELETE USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END delete user territory page + + + + + + +### BEGIN add territory page +if ($action == "ADD_TERRITORY") + { + echo "
\n"; + echo ""; + + echo "
Add Territory\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Territory:
Territory Description:
\n"; + } +### END add territory page + + +### BEGIN process add territory page +if ($action == "PROCESS_ADD_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($territory_description)<1) ) + { + echo "ERROR: Territory and Territory Description must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "ERROR: there is already a territory in the system with this name
\n"; + } + else + { + $stmt="INSERT INTO vicidial_territories SET territory='$territory',territory_description='$territory_description';"; + $rslt=mysql_query($stmt, $link); + + echo "Territory Added: $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$USER', ip_address='$ip', event_section='TERRITORIES', event_type='ADD', record_id='$territory', event_code='ADMIN ADD TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "CALLCARD_SUMMARY"; + } +### END process add territory page + + +### BEGIN delete territory page +if ($action == "DELETE_TERRITORY") + { + if (strlen($territory)<1) + { + echo "ERROR: Territory must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 0) + { + echo "ERROR: This territory is not in the system with this name
\n"; + } + else + { + $stmt="DELETE from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + + echo "Territory Deleted: $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$USER', ip_address='$ip', event_section='TERRITORIES', event_type='DELETE', record_id='$territory', event_code='ADMIN DELETE TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "CALLCARD_SUMMARY"; + } +### END delete territory page + + +### BEGIN modify card status page +if ($action == "CALLCARD_STATUS") + { + if ( (strlen($card_id)<1) or (strlen($status)<1) ) + { + echo "ERROR: Card ID and Status must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from callcard_accounts_details where card_id='$card_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + echo "ERROR: This card_id is not in the system
\n"; + } + else + { + if ($status == 'RESET') + { + $initial_minutes=1; + $stmt="SELECT initial_minutes FROM callcard_accounts_details where card_id='$card_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $im_ct = mysql_num_rows($rslt); + if ($im_ct > 0) + { + $row=mysql_fetch_row($rslt); + $initial_minutes = $row[0]; + } + + $stmt="UPDATE callcard_accounts_details SET status='ACTIVE',balance_minutes='$initial_minutes',used_time=NOW(),used_user='$USER' where card_id='$card_id';"; + $stmtB="UPDATE callcard_accounts SET status='ACTIVE',balance_minutes='$initial_minutes' where card_id='$card_id';"; + } + if ($status == 'VOID') + { + $stmt="UPDATE callcard_accounts_details SET status='VOID',void_time=NOW(),void_user='$USER' where card_id='$card_id';"; + $stmtB="UPDATE callcard_accounts SET status='VOID' where card_id='$card_id';"; + } + if ($status == 'ACTIVE') + { + $stmt="UPDATE callcard_accounts_details SET status='ACTIVE',activate_time=NOW(),activate_user='$USER' where card_id='$card_id';"; + $stmtB="UPDATE callcard_accounts SET status='ACTIVE' where card_id='$card_id';"; + } + $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtB, $link); + if ($DB) {echo "|$stmt|$stmtB|\n";} + + echo "Card ID Status Modified: $card_id - $status
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$USER', ip_address='$ip', event_section='CALLCARD', event_type='MODIFY', record_id='$card_id', event_code='ADMIN MODIFY CALLCARD', event_sql=\"$SQL_log\", event_notes='$status';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "CALLCARD_DETAIL"; + } +### END process modify territory page + + + + +### BEGIN CallCard record Detail page +if ($action == "CALLCARD_DETAIL") + { + + $stmt="SELECT card_id,run,batch,pack,sequence,status,balance_minutes,initial_value,initial_minutes,note_purchase_order,note_printer,note_did,inbound_group_id,note_language,note_name,note_comments,create_user,activate_user,used_user,void_user,create_time,activate_time,used_time,void_time from callcard_accounts_details where card_id='$card_id';"; + $rslt=mysql_query($stmt, $link); + $details_to_print = mysql_num_rows($rslt); + if ($details_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $card_id = $rowx[0]; + $run = $rowx[1]; + $batch = $rowx[2]; + $pack = $rowx[3]; + $sequence = $rowx[4]; + $status = $rowx[5]; + $balance_minutes = $rowx[6]; + $initial_value = $rowx[7]; + $initial_minutes = $rowx[8]; + $note_purchase_order = $rowx[9]; + $note_printer = $rowx[10]; + $note_did = $rowx[11]; + $inbound_group_id = $rowx[12]; + $note_language = $rowx[13]; + $note_name = $rowx[14]; + $note_comments = $rowx[15]; + $create_user = $rowx[16]; + $activate_user = $rowx[17]; + $used_user = $rowx[18]; + $void_user = $rowx[19]; + $create_time = $rowx[20]; + $activate_time = $rowx[21]; + $used_time = $rowx[22]; + $void_time = $rowx[23]; + + $stmt="SELECT pin from callcard_accounts where card_id='$card_id';"; + $rslt=mysql_query($stmt, $link); + $pin_to_print = mysql_num_rows($rslt); + if ($pin_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $pin = $rowx[0]; + } + + echo "
\n"; + echo ""; + + echo "
CallCard Detail\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Card ID: $card_id
PIN: $pin
Status: $status
Run: $run
Batch: $batch
Pack: $pack
Sequence: $sequence
Balance Minutes: $balance_minutes
Initial Minutes: $initial_minutes
Initial Value: $initial_value
Purchase Order: $note_purchase_order
Printer: $note_printer
DID: $note_did
In-Group: $inbound_group_id
Language: $note_language
Name: $note_name
Comments: $note_comments
Create User/Date: $create_user / $create_time
Activate User/Date: $activate_user / $activate_time
Used User/Date: $used_user / $used_time
Void User/Date: $void_user / $void_time
\n"; + echo "


\n"; + + echo "Void This Card ID

\n"; + echo "Activate This Card ID

\n"; + echo "Reset Minutes on This Card ID\n"; + echo "

\n"; + + ### call log + echo "
\n"; + echo ""; + echo "
Call Log for this Card ID:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $stmt = "SELECT call_time,phone_number,inbound_did,balance_minutes_start,agent_talk_min,agent,agent_time,agent_dispo FROM callcard_log where card_id='$card_id' order by call_time;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#B9CBFD"';} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $i++; + } + echo "
#DATECallerIDDIDSTART MINTALK MINAGENTAGENT DATEAGENT DISPO
$i $row[0] $row[1] $row[2] $row[3] $row[4] $row[5] $row[6] $row[7]


\n"; + + echo "Admin Log for this Card ID

\n"; + } + else + { + echo "ERROR: Card ID not found: $card_id
\n"; + } + } +### END card id detail page + + + + + +### BEGIN callcard summary +if ($action == "CALLCARD_SUMMARY") + { + echo "
\n"; + echo ""; + echo "
CallCard Summary:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $stmt = "SELECT count(*),status FROM callcard_accounts_details group by status order by status;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + $Lcount[$i] = $row[0]; + $Lstatus[$i] = $row[1]; + + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#B9CBFD"';} + echo "\n"; + echo ""; + echo ""; + echo "\n"; + + $i++; + } + echo "
STATUSCOUNT
$Lstatus[$i] $Lcount[$i]


\n"; + + $stmt = "SELECT count(distinct batch) FROM callcard_accounts_details;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $db_ct = mysql_num_rows($rslt); + if ($db_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DBcount = $row[0]; + + echo "There are $DBcount batches in the system\n"; + } + echo "

\n"; + + ### call log + echo "
\n"; + echo ""; + echo "
Last 10 Calls:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $stmt = "SELECT card_id,call_time,phone_number,inbound_did,balance_minutes_start,agent_talk_min,agent,agent_time,agent_dispo FROM callcard_log order by call_time desc limit 10;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#B9CBFD"';} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $i++; + } + echo "
#CARD IDDATECallerIDDIDSTART MINTALK MINAGENTAGENT DATEDISPO
$i $row[0] $row[1] $row[2] $row[3] $row[4] $row[5] $row[6] $row[7] $row[8]


\n"; + + echo "\n"; + echo "
\n"; + } +### END callcard summary + + +### BEGIN list batches +if ($action == "CALLCARD_BATCHES") + { + echo "
\n"; + echo ""; + echo "
CallCard Batches:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $stmt = "SELECT count(*),batch FROM callcard_accounts_details group by batch order by batch;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + $Lcount[$i] = $row[0]; + $Lbatch[$i] = $row[1]; + + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#B9CBFD"';} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $i++; + } + echo "
BATCHCOUNTLIST
$Lbatch[$i] $Lcount[$i] LIST


\n"; + + echo "\n"; + echo "
\n"; + } +### END list batches + + + + +### BEGIN search results +if ($action == "SEARCH_RESULTS") + { + if (strlen($card_id) > 1) + {$searchSQL = "card_id='$card_id'";} + if (strlen($run) > 1) + { + $and=''; + if (strlen($searchSQL) > 1) {$and=' and';} + $searchSQL .= "$and run='$run'"; + } + if (strlen($batch) > 1) + { + $and=''; + if (strlen($searchSQL) > 1) {$and=' and';} + $searchSQL .= "$and batch='$batch'"; + } + if (strlen($pack) > 1) + { + $and=''; + if (strlen($searchSQL) > 1) {$and=' and';} + $searchSQL .= "$and pack='$pack'"; + } + if (strlen($sequence) > 1) + { + $and=''; + if (strlen($searchSQL) > 1) {$and=' and';} + $searchSQL .= "$and sequence='$sequence'"; + } + + if (strlen($searchSQL) < 5) + { + echo "you must enter something to search for

\n"; + $action = 'SEARCH'; + } + else + { + echo "
\n"; + echo ""; + echo "
CallCard Batches:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $stmt = "SELECT card_id,status,balance_minutes,create_time,activate_time,used_time,void_time FROM callcard_accounts_details where $searchSQL;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + $Lcard_id[$i] = $row[0]; + $Lstatus[$i] = $row[1]; + $Lbalance_minutes[$i] = $row[2]; + $Lcreate_time[$i] = $row[3]; + $Lactivate_time[$i] = $row[4]; + $Lused_time[$i] = $row[5]; + $Lvoid_time[$i] = $row[6]; + + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#B9CBFD"';} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $i++; + } + echo "
CARD IDSTATUSBALANCECREATEACTIVATELAST USEDVOIDDETAIL
$Lcard_id[$i] $Lstatus[$i] $Lbalance_minutes[$i] $Lcreate_time[$i] $Lactivate_time[$i] $Lused_time[$i] $Lvoid_time[$i] DETAILS


\n"; + + echo "\n"; + echo "
\n"; + } + } +### END search results + + +### BEGIN search +if ($action == "SEARCH") + { + echo " +
\n"; + echo ""; + + echo "
CallCard Search\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Card ID:
Run:
Batch:
Sequence:
\n"; + echo "\n"; + echo "\n"; + } +### END search + + + + + +?> + + + +
CallCard     VERSION:     BUILD: