Call off system

Does the FreePBX have a module or other method to provide an IVR for people to enter employee number and then choose a reason for call off? We’d upload a file of employee numbers and the system could make sure it’s a valid number and then dump the time, employee number, reason for call off into a file.


Yes, you could build this with custom dialplan, and/or a few scripts. Asterisk is pretty flexible. At a high level you would prompt (& check?) for an employee ID, then present your options, read the result and time into a variable, then write the ID, time, and variable to a file, then hang up. This is entirely custom, but not that difficult to accomplish.

This looks promising:

Would it be possible to modify this to include reading a csv file for employee PIN’s? I’m looking more into learning about dial plan but I’m no programmer.

I suggest while searching and waiting for answer, try posting your question as a comment in the blog page that you found.

I wrote a TimeTrex interface a couple of years ago, and have updated a couple of times, that does the “front end” part of this.

Adding the interface to dial out (or connection to DISA) to what I wrote should be reasonably trivial.


Yes. You’re going to have to use dial plan to some degree to make what you want to have happen, unless you happen to get lucky, no one is going to write the code for you.

This looks like something useful:

  1. Create a perl script (like the code attached) and call it something like
  2. Add it to the agi-bin in var/lib/asterisk/agi-bin/
  3. Capture the 7 digits with a read or background, something like…

exten => s,n,Read(pinnumber,then-press-pound,7, ,1,10) ;variable pinnumber will be 7 digits

  1. Send that response to an AGI call

exten => s,n,AGI(/var/lib/asterisk/agi-bin/,${pinnumber})

  1. Check the output…

exten => s,n,GotoIf($[${MATH(${SEARCHCOUNT}>=1,i)}=TRUE]?found)

#!/usr/bin/perl -w
use strict;

my %AGI; my $tests = 0; my $fail = 0; my $pass = 0; my $result = “”;
my $string = “”; my $count = 0;

$string = $ARGV[0];

while() {
last unless length($);
if (/^agi
(\w+):\s+(.*)$/) {
$AGI{$1} = $2;

#Replace the EmployeeNumbers.txt with the file name
open FILE, “</tmp/EmployeeNumbers.txt”;
my @lines = ;
for (@lines) {
if ($_ =~ /$string/) {
$count = $count + 1;

print qq(SET VARIABLE SEARCHCOUNT “$count”\n);

I just need to figure out a way to try to tie these together.
In this example, what will happen after “exten => s,n,GotoIf($[${MATH(${SEARCHCOUNT}>=1,i)}=TRUE]?found)”?

Its a Boolean, so it sounds like if the count is 1 or more, it will move to the (found) step in the dialplan, if not, since there is no specific false step, it would move to the next line of the dialplan after the math line. There is an example dialplan if you scroll further down the link you provided.

Oh, OK… The below does work!
exten => s,n,AGI(/var/lib/asterisk/agi-bin/,${pinnumber})
exten => s,n,GotoIf($[${MATH(${SEARCHCOUNT}>=1,i)}=TRUE]?found)
exten => s,n,PlayBack(no-info-about-number)
exten => s,n,Goto(macro-pincollection,s,1) ; ask to re-enter 7 digit account
exten => s,n(found),PlayBack(validid)

Still playing around and adding different options for a reason for call off… Is there any way while the greetings are playing to allow input? I have to wait till the greeting is done to enter input.

Now that you have a working AGI, you can use the third party module, dyanamic routes for the GUI elements and branching. You can also prompt the caller for dtmf input, store that value and pass to the AGI as and argument.

1 Like

“Is there any way while the greetings are playing to allow input? I have to wait till the greeting is done to enter input.”

You can use ‘background’ instead of PlayBack to allow digit collection during the greeting.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.