Email a user if they forget to log out of a queue?

Hey everyone,

Would this be possible at all? My sales reps forget all the time to log out of the queue at the end of the day. It’s not a huge deal since it automatically closes at 5 but there’s times that people all leave at 4 and forget to log out. Is there any way that I can somehow have it send an automated email to them if it shows no queue log out after say 3:30pm? Would have to do it that way since they log out for lunch. Either that or have it check to see if they logged in then out then in and then finally out again or something similar. Sounds pretty advanced but thought I’d check, thanks!

If they were getting penalized financially for not logging out, they would remember.

Hey thanks for your help, I don’t think that’s what I need though… I have the queue set to close at 5pm so if they don’t log out, my time condition directs customers to our after hours voicemail which is fine. The issue I have is that I use their log in and log out for time keeping. I have them log in when they get to work, log out for lunch, back in, and then log out at the end of the day. That way if I’m not in the office I can see how many hours they worked and see if they left early for example. So that’s why I was sort of looking for something to notify them any time they forget, in hopes that after getting emailed enough they’ll be sick of it!

Using the tool above you could then write a replacement for the removeAgentFromQueue() that sends the emails. If you could hook back to a resource that convert the extensions in the queue to email addresses, you’re set.

I’ve had stragglers before and fixed it with a cron job.

The program will clear out all dynamic queue members from all queues. There are probably better ways to make this magic happen, but it’s been working well for us since July.

I run this against 1.6.x – other versions may need tweaking.

[code]#!/usr/bin/perl -w

pae 3 Jul 2010

use File::Basename;
use Sys::Syslog qw( :DEFAULT setlogsock);

my $debug = 0;
my $scancmd = ‘/usr/sbin/asterisk -rx “queue show”’;
my $clearcmd = ‘/usr/sbin/asterisk -rx “queue remove member %s from %s”’;

sub openSyslog {
my $name = shift;
setlogsock(‘unix’);
openlog($name, ‘pid’, ‘daemon’);
}

sub fetchDynamicAgents {
my $queue;
my $agent;
my %results;

open(IN, "$scancmd|");
while (<IN>) {
chop;
$line = $_;
if ($line =~ /strategy/) {
    $queue = (split)[0];
    print 'sifting through queue: ' . $queue . "\n"
	if ($debug);
}
if (($line =~ /Local/) && ($line =~ /dynamic/)) {
    $agent = (split)[0];
    print '  found dynamic agent: ' . $agent . "\n"
	if ($debug);
    $results{$queue . ' ' . $agent} = 1;
}
}
close(IN);
return %results;

}

sub removeAgentFromQueue {
my $agent = shift;
my $queue = shift;
return ''
if (($queue eq ‘’) || ($agent eq ‘’));
my $cmd = sprintf($clearcmd, $agent, $queue);

print $cmd . "\n"
if ($debug);

# log what we're about to do
syslog('info', $cmd);

open(IN, "$cmd|");
while (<IN>) {
chop;
# log the return values
syslog('info', $_);
}
close(IN);

}

set up logging

openSyslog(basename($0));

gather a hash of all the dynamic agents in the queues

my %actions = fetchDynamicAgents();

print ‘and the survey says:’ . "\n"
if ($debug);

now iterate over the results

foreach my $entry ( keys %actions ) {
print $entry . “\n”;
# remove each entry iteratively
my ($queue, $agent) = split(/ /, $entry);
removeAgentFromQueue($agent, $queue);
}
[/code]