News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

Support for notification popups on computers

Started by MichiganTelephone, February 18, 2011, 10:49:02 AM

Previous topic - Next topic

MichiganTelephone

Quote from: NerdUno on February 22, 2011, 11:35:12 AM
Try these links using the correct IP address of your OBi and then scrape away:

http://192.168.0.109/DI_S_.xml

http://192.168.0.109/callstatus.htm

http://192.168.0.109/callhistory.htm

http://192.168.0.109/PI_FXS_1_Stats.xml

The wget syntax would look like this:

wget --http-user=admin --http-password=yourpassword -qO- http://192.168.0.109/PI_FXS_1_Stats.xml


This looks more promising in the short term (and I'm not sure why I didn't see this post before today, when I was reviewing this thread).  For some reason I couldn't get the wget to work until I removed the -qO- though.

This is the rough (perhaps very rough) equivalent in a Perl script.  It returns a raw XML file (I think):

#!/usr/bin/perl
use LWP::UserAgent;
my $url = 'http://192.168.0.109//PI_FXS_1_Stats.xml';
my $ua = new LWP::UserAgent;
$ua->timeout(2);
$ua->credentials('192.168.0.109:80', 'admin@OBi110', 'admin', 'password');
my $request = HTTP::Request->new('GET');
$request->url($url);
my $response = $ua->request($request);
my $body =  $response->content;
print $body;


However, I'm not sure if the result is "real" XML or pseudo-XML (as I have said, I'm not a programmer).  Figuring out how to extract the useful information out of this is more of a challenge than I'm up for today!
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

plugger2

#21
hi MichiganTelephone,

If I wrote a little polling script that calls Tkinter from python to pop-up a window, could you run that? (I gather you run a mac...)

MichiganTelephone

Quote from: plugger2 on March 09, 2011, 07:52:27 AM
hi MichiganTelephone,

If I wrote a little polling script that calls Tkinter from python to pop-up a window, could you run that? (I gather you run a mac...)

Hi plugger2,

Honestly, I have no idea.  I've never tried to run anything related to Python on a Mac.  I do have a Mac, and I run Growl, and I have managed to run a couple of Perl scripts (with considerable effort — they don't make it easy to install Perl modules on a Mac) but just have never tried to do anything with Python.
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

plugger2

Well, I might try a quick proof of concept app in python, just to see how it's going to work, and then if that's not going to work on a Mac for you, I could reimplement in Perl (I'm a bit rusty on Perl, though.)

The "scraping" actually looks quite easy. All the values are in an html table, so easy to parse:

</table><td>Terminal 1<td>Terminal 2</tr><tr bgcolor=#ffffff><td>Terminal ID<td>PHONE1<td>SP2</tr><tr bgcolor=#eeeeee><td>State<td>peer-ringing<td>peer-ringing</tr><tr bgcolor=#ffffff><td>Peer Name<td><td></tr><tr bgcolor=#eeeeee><td>Peer Number<td>0410xxxxxx<td>0410xxxxxx</tr><tr bgcolor=#ffffff><td>Start Time<td>03:09:55<td>03:09:55</tr><tr bgcolor=#eeeeee><td>Duration<td>00:00:05<td>00:00:05</tr>

etc.

So I think your original idea of 1 sec polling looking for an active call is quite straightforward. This is using the url

http://192.168.0.109/callstatus.htm

as suggested by NerdUno.

It occurs to me that instead of logging in all the time, it might be simpler just to log in once, and stay logged in for the duration once the polling loop starts.

MichiganTelephone

Quote from: plugger2 on March 09, 2011, 09:05:49 AM
Well, I might try a quick proof of concept app in python, just to see how it's going to work, and then if that's not going to work on a Mac for you, I could reimplement in Perl (I'm a bit rusty on Perl, though.)

If I go to a Mac command prompt and type "python" it shows this:

Python 2.5.1 (r251:54863, Sep  1 2010, 22:03:14)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

So I assume that means there's at least some components of the python language installed.  The larger issue (for me, anyway) is whether there is support for Growl.  Apparently there is (for the Mac, anyway, although that page doesn't look very helpful).  Anyway, I have no great love for Perl (especially on a Mac), it's just that if I stare at Perl code long enough it occasionally actually makes sense to me, which is more than I can say for certain other languages (such as C).  ::)
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

plugger2

Quote from: MichiganTelephone on March 09, 2011, 12:14:27 PM

If I go to a Mac command prompt and type "python" it shows this:

Python 2.5.1 (r251:54863, Sep  1 2010, 22:03:14)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

So I assume that means there's at least some components of the python language installed.

Yes, that's definitely a Python installation. At the ">>>" prompt, type

import Tkinter

(it's case sensitive), hit the return key, and tell me what happens. (If it just returns >>>, and there is no error message saying something like "ImportError: No module named Tkinter", then it will probably be OK to go.)

I understand you see something like this is just a stop-gap, but I thought it might be fun anyway. :-)

MichiganTelephone

Quote from: plugger2 on March 10, 2011, 01:51:15 AMYes, that's definitely a Python installation. At the ">>>" prompt, type

import Tkinter

(it's case sensitive), hit the return key, and tell me what happens. (If it just returns >>>, and there is no error message saying something like "ImportError: No module named Tkinter", then it will probably be OK to go.)
>>> import Tkinter
>>>

That's all I got. No error message.
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

plugger2

Quote from: MichiganTelephone on March 10, 2011, 04:46:28 AM
Quote from: plugger2 on March 10, 2011, 01:51:15 AMYes, that's definitely a Python installation. At the ">>>" prompt, type

import Tkinter

(it's case sensitive), hit the return key, and tell me what happens. (If it just returns >>>, and there is no error message saying something like "ImportError: No module named Tkinter", then it will probably be OK to go.)
>>> import Tkinter
>>>

That's all I got. No error message.

Excellent. That means it found and loaded the Tk library. Which means, if I watch out judiciously for cross-platform differences, I should be able to get an app that runs on your Mac, as well as other python endowed machines.

If you are interested, let me know, and I will see what I can whip together as a side project, just for a bit of fun!

MichiganTelephone

Quote from: plugger2 on March 10, 2011, 07:29:07 AMIf you are interested, let me know, and I will see what I can whip together as a side project, just for a bit of fun!
Sure, I'd like to see what you can come up with.  Just be aware that with Python, about I'll be able to tell you is whether it works or not, since I know pretty much zilch about that language.
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

plugger2

Quote from: MichiganTelephone on March 10, 2011, 07:54:20 AM
Quote from: plugger2 on March 10, 2011, 07:29:07 AMIf you are interested, let me know, and I will see what I can whip together as a side project, just for a bit of fun!
Sure, I'd like to see what you can come up with.  Just be aware that with Python, about I'll be able to tell you is whether it works or not, since I know pretty much zilch about that language.

If you can read Perl, I think you would be fine with Python, actually. It's one of the more transparent scripting languages, which is probably why it's so popular. _True_ Perl aficionados delight in it's very obscurity, or so it has always seemed to me! ;-)

Anyway, we shall see what we can cook up. I will keep you posted.

plugger2

#30
hi MichiganTelephone,

I've got an alpha version (standard disclaimer for "still full of bugs, some known, most probably not") of a Python script that calls wget as a subprocess to grab the html from the call status every second or so. There are still a few things I don't understand about what it's doing, as I have two very similar versions, and one seem to be fairly robust with respect to handling the multiple popup windows, whereas as the other isn't (it may be timing problems, and the timing issues only show in one version but not the other. Probably means I have to rewrite some of threading code to  really make it solid, even for the version that appears to be OK now.) In any case, I thought it would be interesting to see if we can get a version running at all on your Mac, to see if this approach has any chance of being portable.

If you are interested, I can email it or ftp it you... only thing is how do we exchange contact info so it doesn't end up in the public domain? I don't think this board has PM. Any ideas?

EDIT: I stand corrected. I've dropped you a PM.

AndroidsOfTara

#31
Quote from: MichiganTelephone on February 18, 2011, 10:49:02 AM
I'd like to throw this out and just see if anyone has any thoughts on this.  In the past, I have set things up so that whenever I get an incoming call, I get a popup on my computer screen.

I seem to have this working on my Ubuntu machine.

I took a bit of Perl code you posted somewhere in this thread and greatly enhanced it.

It polls the OBi every four seconds, grabs callstatus.htm and looks for inbound calls. It properly formats the phone number (xxx-xxx-xxxx) and (this is optional) will look the number up in a CSV contacts file (downloaded from Google Contacts). Finally, it uses Ubuntu's "notify-send" program to display the call on the screen in as a Growl-like notification.

I rarely do any programming, so please don't laugh too hard at my code. If anyone makes improvements, please share with us.

The only Ubuntu specific bit is the like where it calls upon the notify-send program, so I believe this code can very easily be adapted to run on any OS that supports a standard Perl installation.

Enjoy!



#!/usr/bin/perl

use LWP::UserAgent;

my $obi = "10.1.1.5:80";
my $obi_username = "admin";
my $obi_password = "admin";

my $url = 'http://10.1.1.5//callstatus.htm';
my $ua = new LWP::UserAgent;

my $debug = 0;
my $use_contacts = 0;

my $poll_time = 4;
my $sleep_time = 30;

if ($use_contacts == 1) {
   print "Importing contacts...\n";
   open(DATA,"<contacts1.csv") or die "Can't open data";
   @contacts = <DATA>;
   close(DATA);
}

$ua->timeout(2);
$ua->credentials($obi, 'admin@OBi110', $obi_username, $obi_password);

# loop forever
while(1) {

   my $contact = "N/A";
   
   my $request = HTTP::Request->new('GET');
   $request->url($url);
   my $response = $ua->request($request);
   my $body =  $response->content;
   
   # look for 11 digit phone number
   my @phones = $body =~ /\d{11}/g;
   my $phone_number = $phones[0];

   # look for the string "ringing"
   # note: ringing state is "ringing" for inbound calls and "peer-ringing" for outbound calls
   my @status_ringing = $body =~ /ringing/g;
   my $phone_ringing = $status_ringing[0];

   # look for the string "inbound"
   my @status_direction = $body =~ /Inbound/g;
   my $call_direction = $status_direction[0];

   if ($debug == 1) {
print "---------------------------\n";
print "Phone: $phone_number\n";
print "Ringing: $phone_ringing\n";
print "Direction: $call_direction\n";
   }

   # check for inbound ring ("ringing") and not outbound ring ("peer-ringing")
   if ($phone_ringing eq "ringing") {
# check for an inbound call
if ($call_direction eq "Inbound") {
   if ($phone_number) {
$phone_number = formatPhoneNumber($phone_number);
$contact = searchContacts($phone_number);
my $message = "Incoming call from $contact ($phone_number)";
print "$message\n";
system("notify-send '$message' -t 2000");
sleep($sleep_time);
   }
}
   }
   sleep($poll_time);
}

# properly format phone number
sub formatPhoneNumber {
my $number = shift;
my $number_length = length($number);
if ($number_length > 10) {
   $number = substr($number, 1, 10);
}

$number =~ /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;

my $number_formatted = "$1-$2-$3";

return $number_formatted;
}

# search contacts for phone number and return a contact name
sub searchContacts {
   my $contact_search = shift;
   my @contact_data = grep(/$contact_search/, @contacts);
   my $contact = $contact_data[0];
   my @contact_parts = split(',', $contact);
   my $contact_name = @contact_parts[0];
   $contact_name =~ s/"//g;
   return $contact_name;
}


MichiganTelephone

Quote from: AndroidsOfTara on March 26, 2011, 01:56:09 PM
Quote from: MichiganTelephone on February 18, 2011, 10:49:02 AM
I'd like to throw this out and just see if anyone has any thoughts on this.  In the past, I have set things up so that whenever I get an incoming call, I get a popup on my computer screen.

I seem to have this working on my Ubuntu machine.

I took a bit of Perl code you posted somewhere in this thread and greatly enhanced it.

Want to know the funny part?  I hadn't seen your message and I started messing around with some Perl code this week.  Didn't finish it (got everything but the part that generates the actual popups) but since you're working on this I'll show you what I have and you can see if there is anything at all you want to use (assuming you can figure it out).  I am NOT a programmer so that's why something like this takes me so doggone long.

It polls the Obi once per second but in this demo only for 20 seconds, and prints out any notifications it receives (though what I found was that it does it after the program stops running, probably because you have to do something to flush the buffer and I don't know what).  It does not have a contact search feature, but it does format 11 or 10 digit NANP numbers with dashes and 9 digit OBiTALK numbers with spaces.  It also shows the time and day that the call was received (this might be especially useful if you use something like the "Recent Notifications" program with Ubuntu) and a destination identifier (whatever you put in the $ext variable near the top - it's helpful if you are monitoring more than one device and want to know which is ringing).

You obviously know more about Perl than I do so I don't know if there's anything here you would care to use, but if there is, feel free.

#!/usr/bin/perl
use LWP::UserAgent;

my $ext='2345';
my $ip='192.168.0.123';
my $pw='password';
my $obi='admin@OBi110';

my $regex1 = qr/current="(.*?)" >/;
my $regex2 = qr/type="input" default=" " current="&apos;(.*?)>/;
my $regex3 = qr/^(.*?)&apos;/;
my $regex4 = qr/&apos; (.*?)"/;

my @months = (
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
);
my @weekdays = (
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
);

my $url = "http://$ip//PI_FXS_1_Stats.xml";
my $ua = new LWP::UserAgent;
$ua->timeout(2);
$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 @cidnum = $cid[0]  =~ /$regex4/g;
$num = $cidnum[0];
$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"$cidname[0]\n$num calling $ext at $fulldate\n";
}
}elsif ( $status[0] ne ""){
           if ( $flag == 1 ) {
$flag = 0;
}
}
}
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

oleg

I am curious why nobody mentioned SysLog facility. It's already implemented in OBi110 and for SIP calls can send more than enough information to the destination computer (although for GV calls it lacks call details - I hope OBi developers will catch up here  ;)). Quite simple processing script may extract necessary details and pop-up message. Just my $0.02  :)

QBZappy

#34
MT

Just to suggest another possible option.

I know you are interested in finding a solution to obtain SIP notifications over the network using Growl. I  came across this site which mentioned a open source SIP phone which works with Growl. It seems to work under Mac OS X as well. This might be something which might interest you.


http://en.wikipedia.org/wiki/Jitsi

Summary:
Jitsi (formerly SIP Communicator) is a VoIP, video conferencing, and instant messaging application for Windows, Linux and Mac OS X. It supports several popular instant messaging and telephony protocols.

Released under the terms of the GNU Lesser General Public License, Jitsi is free and open source software.

Jitsi is mostly written in Java which helps reuse most of the same code over the various operating systems it works on. The project also uses native code for the implementation of platform specific tasks such audio/video capture and rendering, IP address selection, and access to native popup notification systems such as Growl.

Edit: I just installed it on my Win 7 netbook. Network notifications is set enabled by default. Look under Tools->Options->Events for this setting. I don't use Growl, so unfortunately I can not test it.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

MichiganTelephone

#35
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.
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

MichiganTelephone

#36
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 one
  • Change 192.168.0.123 to the fixed IP of your OBi device
  • Change password to the admin password of your OBi device
  • Change admin@OBi110 to admin@OBi100 if you have an OBi100
  • Uncomment 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:

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):

eval { system("notify-send –urgency=\"critical\" –icon=\"phone\" \"$name\" \"$num calling $ext at $fulldate\"") };
warn() if $@;


Here's the revised 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="&apos;(.*?)>/;
my $regex3 = qr/^(.*?)&apos;/;
my $regex4 = qr/&apos; (.*?)"/;

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
Inactive, no longer posting or responding to messages.  Goodbye and good luck.  Some of my old Obihai-related blog posts have been moved to http://tech.iprock.com - note this in NOT my blog; I have simply given the owner permission to repost some of my old stuff.

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?
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

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