We migrated from an old Panasonic key system to Trixbox 2.6 and my team loves everything about it except for one thing: losing the ability to see whose extension is ringing and pick it up from any phone. This problem was most keenly felt while in the kitchen; employees munched away happily, not knowing they were missing an important call.
When I learned that Pro-lite signs like the Pro-Lite TruColor II were available periodically on ebay for around $100 and elsewhere for around $200, I started poking around the web to see if anyone had developed Linux drivers for the serial port on these signs. Sure enough, there were many people out there programming these signs. I found a comprehensive set of commands at http://wls.wwco.com/ledsigns/prolite/ProliteProtocol.html, for example.
This was all I needed to get the sign initially working in centOS:
ln -s /dev/ttyS0 /dev/prolite chmod a+rw /dev/prolite stty opost -ocrnl onlcr < /dev/prolite
Then I could send commands to the sign with a simple echo:
echo "<ID01><PA>Enrich Consulting " > /dev/prolite
This was perfect, because our trixbox was already in the kitchen, so it was easy enough to route a serial cable from the server to the sign and mount the sign on top of a cabinet.
In order to ensure the sign would be ready to accept commands after a reboot of my trixbox, I saved the following as signfix in /etc/init.d:
#!/bin/bash # # Simple script to fix the permissions on the serial port # # chkconfig: 2345 90 10 # description: signfix - sets the permissions on COM1: chmod a+rw /dev/ttyS0 exit
And then used Chkconfig to make sure that signfix would run every boot:
chmod 755 signfix Chkconfig --add signfix
Next I went out looking for something a little more turnkey, and found a hobbyist-built Prolite application on CPAN (http://search.cpan.org/dist/ProLite/). This module is really cool because it provides a higher-level interface to the sign. There was only one fix I needed to make to the Prolite.pm code: in the sendCommand subroutine I needed to add $global = 1; just before the do loop. Otherwise the sendCommand subroutine would wait forever expecting an echo of the command just sent to the sign; my sign didn't seem to be capable of echoing the command it had just received without garbling it.
The next step was to create a script that trixbox could run whenever a call came in that would post the call on the sign in the kitchen. The script needs to send a directive to the sign, sit tight for 10 seconds, and then clear the sign. I wanted the sign to show something like:
Richard: Mann, Thomas 408-555-1212
I've trained our staff to dial **ext on the kitchen phone to answer their calls. That works well for us, though I know others have reported problems with directed call pickup under trixbox 2.6.
I saved the following as cid.agi in var/lib/asterisk/agi-bin:
#!/usr/bin/perl
use lib 'blib/lib';
use ProLite qw(:core :commands :colors :styles :dingbats :effects);
my $s = new ProLite(id=>1, device=>'/dev/ttyS0', debug=>0, charDelay=>2000);
$|=1;
open STDOUT, '>/dev/null';
fork and exit;
my $cidnum = $ARGV[0];
my $cidname = $ARGV[1];
my $extension = $ARGV[2];
$err = $s->connect();
die "Can't connect to device - $err" if $err;
if ( IsNumeric( $cidnum ) ) {
if (length($cidnum) == 10) {
$cidnum = substr($cidnum,0,3) . '.' . substr($cidnum,3,3) . '.' . substr($cidnum,6,4);
} else {
$cidnum = substr($cidnum,0,2) . '-' . substr($cidnum,2);
}
}
$s->wakeUp();
$s->setPage(24, " ");
$s->runPage(24);
$s->setPage(25, RESET, green, "$extension:", red, " $cidname", orange, " $cidnum ") ;
$s->setPage(26, beep, telephone, " ", chain(25));
$s->runPage(26);
sleep(10);
$s->setPage(25, " ");
sub IsNumeric {
my $val = $_[0];
my $DIGITS = qr{ \d+ (?: [.] \d*)? | [.] \d+ }xms;
my $SIGN = qr{ [+-] }xms;
my $NUMBER = qr{ ($SIGN?) ($DIGITS) }xms;
if ( $val !~ /^${NUMBER}$/ ) {
return 0; #Non-numeric
} else {
return 1; #Numeric
}
} #End IsNumeric
exit;
Then I needed to override from-did-direct so that my cid.agi script would get called. I'm sure there is a much better way of doing this, but it worked for me. The following went into extensions_override_freepbx_custom:
[from-did-direct]
exten => 125,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Rich)
exten => 125,n,Goto(from-did-direct-post-sign,125,1)
exten => 103,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Ron)
exten => 103,n,Goto(from-did-direct-post-sign,103,1)
exten => 102,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Rick)
exten => 102,n,Goto(from-did-direct-post-sign,102,1)
exten => 123,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Jane)
exten => 123,n,Goto(from-did-direct-post-sign,123,1)
exten => 108,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Jill)
exten => 108,n,Goto(from-did-direct-post-sign,108,1)
exten => 111,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Jasper)
exten => 111,n,Goto(from-did-direct-post-sign,111,1)
exten => 198,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Conf1)
exten => 198,n,Goto(from-did-direct-post-sign,198,1)
exten => 199,1,AGI(cid.agi|${CALLERID(num)}|${CALLERID(name)}|Conf2)
exten => 199,n,Goto(from-did-direct-post-sign,199,1)
include => ext-findmefollow
include => ext-local
New extensions need to be added to this by hand, which is ok for me since I only wanted our consulting team to be listed here, since they are the ones worried about missing calls. Once the sign was loaded up we would need to continue with the original directives that were in the from-did-direct context, so the following went into extensions_custom.conf:
[from-did-direct-post-sign] include => ext-findmefollow include => ext-local
That was it! This was my first trixbox scripting project, my first agi project, my first perl project, and my first Linux serial port project. No one at my office knows what I had to go through for this to work, or how satisfying it is for me to see the messages scroll by while I wait for my espresso to pour! I hope that others can build their own sign applications using the trail of crumbs I've left here.
I am having trouble finding the prolite signs on ebay these days (I did all of this last winter) but there are plenty of other programmable signs out there, like those at www.bigbrite.com. You might ask Gary at bigbrite if he has any more Prolite Trucolors; he used to post them on ebay when he had them.
Happy Trixing,
Rich

Member Since:
2007-08-08