Support for notification popups on computers
MichiganTelephone:
oleg: Probably the reason no one mentioned Syslog is because it's something few people understand. For example, how would you capture the output of Syslog, convert it into something useful, and display it on a Windows or OS X based machine? And also, what I was really wanting to monitor was calls being sent to the phone port, not necessarily all SIP traffic (particularly in a case where a device does double duty as a gateway of some kind). I guess my main question, though, would be how do you capture the Syslog output in a Perl script or something of that nature?
QBZappy: An interesting suggestion, although it wouldn't appeal to me personally because of the "software bloat" involved - if all I want is a popup, I don't really want to be running a program that includes all sort of other functions I'd never use, and particularly one based on Java (I don't know why, but on my Mac Java-based applications seem to load very slowly and consume a lot of system resources). And as I said to oleg, I'm not looking for SIP notifications, what I want is notification of calls coming to the phone port, whether they come in via SIP, Google Voice, the OBiTALK network, or the Line port.
To all: I'm not saying that these suggestions wouldn't be useful to anyone, but unless I'm missing something here, they're really not what I was looking for. The script I posted yesterday is pretty much what I'm looking for, except I'll need to remove the 20 second timeout, and remove the print statement and substitute a system call to whatever command line program invokes a popup notification (notify-send on Linux, growlsend on OS X, etc.). Although, if I knew of a way to actually receive and process Syslog output in a script, and if it actually contains information I could use to tell what is being sent to the Phone port, that might be more efficient than polling the device every second. But at the moment I have no idea how to do that.
MichiganTelephone:
Here is another version of the Perl script I posted above — it's still very much experimental code and may be buggy. The difference from the previous post is that if there is an Asterisk box on your local network that is running the CallerID Superfecta module, you can use that to possibly get a name for your incoming Google Voice calls. If you don't have CallerID Superfecta it will still work. And you will still need to make some changes to the script:
At the top:
Change 2345 to some designation that describes the receiving phone. It could be an extension number, the full Google Voice number, the name of the device… it's just to identify which device the call is coming in on in case you have more than oneChange 192.168.0.123 to the fixed IP of your OBi deviceChange password to the admin password of your OBi deviceChange admin@OBi110 to admin@OBi100 if you have an OBi100Uncomment the "my $superfecta" line and change the ip address from 192.168.0.234 to the address of the Asterisk/FreePBX server running the CallerID Superfecta module, if you have one available. Don't uncomment the line if you don't have access to such a server.
After you are finished testing change while ($count < 20) { to while (1) { to eliminate the 20 second timeout
Change the line print"$name\n$num calling $ext at $fulldate\n" to a system call to the notification system on your machine. For example, these two lines should work on a Mac or Windows machine, provided you have Growl (or Growl for Windows) and growlnotify installed:
Code:
eval { system("growlnotify -s -p 1 -a Telephone -m \"$num calling $ext at $fulldate\" \"$name\"") };
warn() if $@;
Leave out the "-a Telephone" if you don't have the Telephone app installed, I'm just using its icon in the notifications. Or on a Ubuntu system (untested, but it should work if notify-send is installed):
Code:
eval { system("notify-send –urgency=\"critical\" –icon=\"phone\" \"$name\" \"$num calling $ext at $fulldate\"") };
warn() if $@;
Here's the revised code:
Code:
#!/usr/bin/perl
use LWP::UserAgent;
my $ext='2345';
my $ip='192.168.0.123';
my $pw='password';
my $obi='admin@OBi110';
# my $superfecta="http://192.168.0.234/admin/modules/superfecta/bin/callerid.php?thenumber=";
my $url = "http://$ip//PI_FXS_1_Stats.xml";
my $regex1 = qr/current="(.*?)" >/;
my $regex2 = qr/type="input" default=" " current="'(.*?)>/;
my $regex3 = qr/^(.*?)'/;
my $regex4 = qr/' (.*?)"/;
my @months = (
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
);
my @weekdays = (
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
);
my $ua = new LWP::UserAgent;
print "starting\n";
$ua->timeout(10);
$ua->credentials("$ip:80", $obi, 'admin', $pw);
while ($count < 20) {
$count++;
sleep 1;
my $request = HTTP::Request->new('GET');
$request->url($url);
$request = $ua->request($request)->content;
my @status = $request =~ /$regex1/g;
if ( $status[0] eq "Ringing" ) {
if ( $flag== 0 ) {
$flag = 1;
my @cid = $request =~ /$regex2/g;
my @cidname = $cid[0] =~ /$regex3/g;
my $name = $cidname[0];
my @cidnum = $cid[0] =~ /$regex4/g;
my $num = $cidnum[0];
if (defined $superfecta) {
if ( $name =~ /^\+1(\d{10})$/ ) {
$name = HTTP::Request->new('GET');
$name->url("$superfecta$num");
$name = $ua->request($name)->content;
}
}
$num =~ s/^([2-9])(\d{2})([2-9])(\d{2})(\d{4})$/$1$2-$3$4-$5/;
$num =~ s/^(1)([2-9])(\d{2})([2-9])(\d{2})(\d{4})$/$1-$2$3-$4$5-$6/;
$num =~ s/^([2-9])(\d{2})(\d{3})(\d{3})$/$1$2 $3 $4/;
my (
$sec, $min, $hour, $mday, $mon,
$year, $wday, $yday, $isdst
) = localtime(time);
my $ampm = "AM";
if ( $hour > 12 ) {
$ampm = "PM";
$hour = ( $hour - 12 );
}
elsif ( $hour eq 12 ) { $ampm = "PM"; }
elsif ( $hour eq 0 ) { $hour = "12"; }
if ( $min < 10 ) { $min = "0" . $min; }
$year += 1900;
my $fulldate =
"$hour:$min $ampm on $weekdays[$wday], $months[$mon] $mday, $year";
print"$name\n$num calling $ext at $fulldate\n";
}
}elsif ( $status[0] ne ""){
if ( $flag == 1 ) {
$flag = 0;
}
}
}
One note: As written, the CallerID Superfecta module is only called if the Caller ID name matches the pattern +1 followed by ten digits, which is what you get on incoming Google Voice calls. And no, I would have no clue whatsoever as to how to make the CallerID Superfecta module run independently of Asterisk and FreePBX — it's written in PHP and I don't know PHP (other than occasionally I can hack someone else's PHP program to make a minor chage, but that's about it. This would not be a minor change!).
EDIT: However, it appears as if someone is trying to make a standalone version of CallerID Superfecta - however, I know nothing about this projects beyond what's posted in this message: CallerID web service
tmetro:
Polling and scraping is not a particularly satisfying solution.
Processing the syslog messages is a step better. There are some syslog daemons that will run on Windows, but I don't think the protocol is that complicated. One could create a Perl program that listens for syslog messages and then uses the native notification scheme, or a broadcast network notification mechanism. (Syslog itself can be broadcast, but that would need to be configured on the OBi.)
However, this doesn't strike me as something that should be broadcast. I think using SIP is the better approach, and I'd rather see the OBi developers expand the OBi to handle multiple SIP extensions, rather than adding network notifications for caller ID.
I don't own an OBi, but I've addressed this same need with a virtual PBX service I use. My solution was to run the Twinkle SIP softphone (Linux-only I believe). It supports triggering scripts - much like a web server runs a CGI script - on various events. It provides all the SIP headers as environment variables. I threw together some Perl code triggered on an inbound call that looks up the number in an SQLite database to get a name or the geographic region, then displays the name and number on the desktop with libnotify, and speaks the information with espeak.
It seems one could apply this same technique to the OBi today. According to articles I've seen you can configure one of the SIP provider slots to attach to a SIP phone, and you can set call routing rules so that the SIP phone gets rung in parallel with the attached analog phone. The big downside is that it uses up one of only two SIP slots. (A frequently noted limitation of the OBi, which is otherwise overflowing with features. Though if they expand it much more it'll be less of an ATA and more of a micro PBX.)
It wouldn't be a huge project to create some cross-platform Perl code that acts as a SIP end-point and then as above uses the native notification scheme to show caller ID data.
You typically don't get name information through SIP, so ideally you want a tool that can access a database, which is manageable through some user friendly UI so you can add names for your frequent contacts.
-Tom
QBZappy:
Did you consider using one of the 8 gateways instead of using up one of the SIP accts?
psichel:
I have implemented notification popups for the Mac in Phone Amego by polling the callstatus page.
http://www.sustworks.com/pa_guide/OBi110.html
It was pretty straight forward, much simpler than dealing with a SIP connection. For the Linksys/Sipura SPA-3102 and similar, Phone Amego is able to act as a debug log server to be notified when the call status changes and then request the corresponding status page. This didn't work for the OBi110 Syslog because there are no status indications for Google Voice calls at this time.
To make notification popups more efficient, call status changes on any terminal (SP1, SP2, LINE, and PHONE) need to be alerted in the Syslog. Once alerted, the software can request the corresponding status page as needed. Ideally this would include on-hook and off-hook transitions on the PHONE and LINE ports as well.
The OBi110 is a remarkable device. With a few tweaks, it could be a dream for computer telephone integration. My other two suggestions are:
(1) Support for Click-to-Dial allowing a LAN host to initiate a call between any two terminals.
(2) A promiscuous mode for the LINE port that would allow the OBi box to detect call events (on hook, off hook, ring, DTMF) not initiated from the OBi box itself. I realize this probably isn't possible with the current hardware, but I wanted to mention the idea anyway. Existing Ethernet connected call monitoring boxes cost over $100 per port.
Respectfully Submitted,
- Peter Sichel
Sustainable Softworks
Navigation
[0] Message Index
[#] Next page
[*] Previous page