Call off system


(Chris Knight) #1

Hello,
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.
Thanks!


(Communication Technologies) #2

No

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.


(Chris Knight) #3

This looks promising: http://randomcontributions.blogspot.com/2018/04/collect-pin-number-value-in-asterisk.html?m=1

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.


(Moussa) #4

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


(Dave Burgess) #5

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.


(Communication Technologies) #6

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.

http://the-asterisk-book.com/1.6/dialplan-grundlagen.html


(Chris Knight) #7

This looks like something useful: https://www.experts-exchange.com/questions/23804257/Parsing-a-text-file-in-Asterisk-to-used-in-an-inbound-IVR-Campaign.html

  1. Create a perl script (like the code attached) and call it something like searchfile.pl
  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/searchfile.pl,${pinnumber})

  1. Check the output…

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


#!/usr/bin/perl -w
use strict;
$|=1;

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

$string = $ARGV[0];

while() {
chomp;
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)”?


(Communication Technologies) #8

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.


(Chris Knight) #9

Oh, OK… The below does work!
exten => s,n,AGI(/var/lib/asterisk/agi-bin/searchfile.pl,${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.


(Lorne Gaetz) #10

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. https://github.com/johnfawcett/dynroute


(Mschuster) #11

“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.


(system) closed #12

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