OBiTALK Community

General Support => Feature Requests => Topic started by: MichiganTelephone on February 18, 2011, 10:49:02 am



Title: Support for notification popups on computers
Post by: 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.  The popup looks something like this (imagine it in a notification balloon on your computer):

John Smith
234-555-2368
for 789-555-2222
11:57 AM on Friday, February 18, 2011

The first line is the Caller ID name, the second is the Caller ID number.  The third is an indication of the line called - here I show an 10 digit number but it could be any kind of text string that identifies the line.  The fourth is self-explanatory - a human-friendly timestamp.

There are two different ways I could generate this notification.  If the call was coming from Asterisk, I could use a Perl script running on the server (http://michigantelephone.wordpress.com/2010/07/24/a-perl-script-to-send-caller-id-popups-from-asterisk-to-computers-running-growl-under-os-x-on-a-mac-growl-for-windows-or-mumbles-under-linux/), whereas if the call was coming in on a Linksys/Sipura adapter, I could use a script to poll the adapter's web page once per second (http://michigantelephone.wordpress.com/2008/03/23/beta-perl-script-for-caller-id-popups-when-using-linksyssipura-devices/), detect when the state of a line changed to "ringing", and then grab the data I needed from that page to generate a notification.

Neither of those approaches are particularly elegant and besides, if you're not getting calls from an Asterisk server you control, the first method is out.  And the OBi devices don't presently have a single screen that displays all the necessary information, so the second method won't work either.  So I have a few possible ideas for ways that the OBi designers could make notifications possible, just to get people thinking about this:

1) The poll page.  This would be a specially constructed page in the adapter's web portal, for example http://obi-IP-address/notifications.  It would contain all the necessary information to construct a notification:

A section for each "provider" and port on the device, headed sp1, sp2, pp1, li, ph, etc.
Under each section, the current status of the line or device, e.g. ringing, onhook, etc., and the current (if ringing or connected) or previous (if idle) Caller ID Name and Number (on separate lines, or if presented in XML format, under separate tags).

The idea is you have a very simplistic, very minimal page that's designed to be accessed once per second by some other program which then grabs the necessary information on any line or service (that you are interested in) that has just gone into "ringing" state (since the last time you polled it), and formats it into a notification.  The page itself should be extremely minimal - no graphics, no extraneous text, just the bare information necessary, or else in XML format.  If you're polling something once per second if would be better if you didn't have to grab several thousand characters of text just to extract the couple of hundred or so bytes of information you might be interested in.

Obviously the poll page would not generate the notifications - some external program would do that.  This would just give the external program the information it needs.  It's very simple, although not very efficient.

EDIT:  Since originally posting this, I have discovered that all the necessary information is available on the device's Status - Call Status page, however it's not exactly in the best format for this purpose and as far as I can see, it's not available at all until you authenticate (login) with the device, which means you couldn't use something like a simple wget (on a unix/linux type system) to fetch the information.  Even trying to view the page's source doesn't yield the required information because apparently it's using some form of Javascript.  And if you attempt to refresh the page, it throws you back to the main "System Status" page.

2) Poll page + broadcast - same idea as above, except that in addition to the poll page, a network "broadcast" message would be sent to the entire LAN whenever something goes into "ringing" status. Interested clients would look for this message, then come to the device to grab the details (so a properly constructed client would only poll the adapter when a broadcast message is received, not once per second).

3) Full network Growl support.  Growl is a notification system that first appeared on the Mac, but a windows version (Growl for Windows) has gained considerable acceptance.  In addition, Linux users can use a program called Mumbles to receive and display network Growl notifications (http://michigantelephone.wordpress.com/2010/07/18/how-to-receive-and-display-growl-network-notifications-using-ubuntu-linux/).  So the idea is that you'd have a new page on the OBi, possibly under User Settings, where you could set the addresses of computer(s) that you wanted to send Growl notifications to.  For each computer you'd need to be able to specify an IP address, Growl network password, and then select which lines or devices you wanted to receive notifications on (probably using checkboxes).  You might also want to give people a way to change the formatting of their actual notification message, using substitution variables for the Caller Name, Caller Number, and standard Unix-style time-date variables.

Number 3 is more work to implement (although there are Growl modules available for several languages that do all the hard work for you) but it supports a notification system that's pretty standard in the Mac and Windows worlds (well, as standard as anything not explicitly blessed by Microsoft).

4) The http request.  If you don't want to implement Growl support, another approach is a simple HTTP request.  In this case you'd simply need to have a way that the user could execute specific HTTP requests whenever a selected service or device went into the ringing state (so again you'd need checkboxes to specify which services to monitor).  In Asterisk, for example, I can do something like this:

Code:
TrySystem(wget -b -O /dev/null -o /dev/null "http://192.168.0.123:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Notification(Call%20from%20%22${URIENCODE(${CALLERID(name)})}%22%2C${CALLERID(number)}%20calling%20251%2C15000%2C%2Fhome%2Fuser%2Fphone.png)")

Where 192.168.0.123 is the destination machine to receive a notification, ${CALLERID(name)} and ${CALLERID(number)} contain the substitution variables we need, and home%2Fuser%2Fphone.png points to an icon on the destination machine.  This is just an example to show how complicated some of these types of calls can get — the one shown here would throw up a call notification on a PC running either the XBMC or Boxee home theater software, assuming the software was properly configured to receive notifications.  The problem with this approach is that while it works well for a machine running a web server (even a minimal one), it's not so great for notifications to normal user machines that don't usually have a web server in operation.

5) Jabber IM.  Another method is to simply use the Jabber client that may already be present to enable Google Voice, and send notification messages via that channel (specifically, via Google Talk).  

In Asterisk I have used this to send a Jabber notification:

JABBERSend(googletalkuser,localgvaccount@gmail.com,Call from ${CALLERID(name)} at ${CALLERID(number)} for extension 234 received: ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})

googletalkuser is the screen name of the Google Talk user you want to send the notification to.  localgvaccount was in this case the Gmail address associated with the particular Google Voice account for which I was sending the notification.  234 is the extension I was sending the calls to - again, this is just an identifier string so you have some idea where the calls came from or where they are going.  The drawbacks to this is that the OBi device would have to be registered with Google (which now may only be the case if you are actually using a Google Voice number on SP1 or SP2) and the user receiving the notifications would have to be running a Google Talk or other IM client that could receive the messages. The advantage is that you can send notifications to a user anywhere, not just on the local network.

6) Something I haven't considered. ???

Personally, as a user I would prefer #3, because Growl is pretty easy to set up and can be useful for a lot more than just call notifications (on the Mac in particular, a large number of programs use it, and on Windows it's becoming fairly well supported also).  But failing that, #2 or #1 would probably provide the most flexibility because essentially it gives the necessary information in the simplest form and lets you write an external client to massage it into whatever form you need or want, plus it would probably be easiest for the Obihai guys to implement.

I'm just wondering if anyone else thinks this would be worthwhile and if they might favor any particular approach — or alternately, if something like this already exists and I'm just not aware of it.




Title: Re: Support for notification popups on computers
Post by: gerry on February 18, 2011, 03:16:10 pm
Michigan,
The Google Mail incoming notification is not bad. Very similar to your version of the popup, and you can answer, screen, or ignore calls, as well as (in theory) switching to any of your other GV phones by hitting "*". The downside is that you need to have Gmail running, although perhaps OBi could provide a PC equivalent?
Gerry


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 18, 2011, 03:50:24 pm
I understand that the Obiapp is going to behave more like a softphone. Every softphone I have ever used pops up the CID info of the incoming call. That would be an obvious client to use for the CID pop ups. Some other more flexible method would allow someone to ingrate these pop ups into contact management software or MS Outlook. Something similar as Outcall for Asterisk. Since a pop up implies that the computer is running, perhaps the Obiapp can offer all the info necessary in a format that can be accessed by 3rd party applications.

Perhaps another approach to consider. There are pros and cons of every technique that might be considered.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on February 18, 2011, 04:54:18 pm
Appreciate the discussion, this is good.

Unfortunately, actually leaving Gmail open would not be a workable a solution because that can kill incoming Google Voice calls.  Also, it's not really a popup, and also I'm looking for a solution that would work with all varieties of incoming calls no matter how they arrive — I don't want it to be limited to Google Voice calls.

As for OBiAPP, I don't know if there's any way it would serve this purpose, but right now the biggest problem I personally have with that is that I'm not running a Windows-based system, and the OBiAPP software will not run under Mac OS X (I even tried running it under Codeweavers Crossover, which you can think of as a commercial version of WINE, but it will run more Windows-based software than Wine — but in this case the installer failed so I could never get it to work).  That's why I tried to make my suggestions fairly non-platform-specific — something that only runs under Windows isn't going to work for me.

However, I remember reading somewhere that the OBi devices allow SIP-based subscriptions to pull certain information.  But i have no idea if that would work to pull the required information for the popups, and also I have really no idea how to use those at all (not even in Asterisk/FreePBX).  And I doubt there's any SIP-based notification scripts or software out there (though I'd be happy to be proven wrong).


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 18, 2011, 08:55:48 pm
If you are thinking of taking the SIP route, what you are implying is approach using a network protocol analyzer (i.e. wireshark) set up with a filter set to identify SIP. Then you can have the info sent into a text file and manipulate the data into any shape you need it. I have come across call recording software based on this concept. Then you can look for "200 OK" messages in the text file.

What do you think?


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on February 19, 2011, 01:18:47 am
QBZappy, I think you'd have to know a lot more about networking than I do to make that work!

I don't know that much about wireshark, but in order to use that don't you have to have the traffic from the device you want to monitor flow through the computer that is running wireshark?

My thought there was that the SIP subscription was something that MAYBE could be accessed by a piece of software not involved in the actual call.  But either way, that would be far down the list of my preferred ways to generate notifications, unless perhaps I had a much better understanding of how it works.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on February 19, 2011, 02:09:23 am
For anyone following this thread I added a paragraph to my original post.  I got to looking around the device's web portal tonight and noticed something I hadn't previously:

Quote
EDIT:  Since originally posting this, I have discovered that all the necessary information is available on the device's Status - Call Status page, however it's not exactly in the best format for this purpose and as far as I can see, it's not available at all until you authenticate (login) with the device, which means you couldn't use something like a simple wget (on a unix/linux type system) to fetch the information.  Even trying to view the page's source doesn't yield the required information because apparently it's using some form of Javascript.  And if you attempt to refresh the page, it throws you back to the main "System Status" page.

Try accessing that page during an incoming call (before it's answered) and you'll see what I mean - all the information is there, it's just not in a format that could be easily "scraped" by an external script or a notification program.  You'd first have to authenticate with the device, then figure out how to get past the Javascript to get the page data you want, and then parse that data in order to extract the elements you need (keeping in mind that there could be more than one simultaneous connection).  :o

Not exactly a programming challenge that I'd personally be up for!



Title: Re: Support for notification popups on computers
Post by: QBZappy on February 19, 2011, 08:44:31 am
Hi,
You might be interested in the following short video explaining wireshark. Narrator dose not talk about SIP filters, however in a voip application these filters can be setup. It takes some of the mystery out of wireshark. It is a useful tool for troubleshooting voip setups. I believe you can also do what you indent to do using this approach. There might be some learning involved.

I will try to locate the call recording software which monitors sip traffic using this approach. I might get some insight in using this approach.


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 19, 2011, 08:47:31 am
Looking at the call history. There is a lot of info there. Might be good to see if that info is available during the call or after the call is finished. You might be able to read that info with your script approach.


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 19, 2011, 09:56:36 am
Here is the link to the video http://media-2.cacetech.com/video/wireshark/introduction-to-wireshark/


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on February 19, 2011, 10:57:20 am
QBZappy - I watched your video but it did not explain how it would show me traffic that's not flowing through the computer that is running Wireshark.  Since the OBi devices communicate directly with the Internet, their traffic would not be available to Wireshark.  The only thing Wireshark might be able to capture is traffic between the user's computer (specifically the Web browser) and the OBi device's web interface.  And that's assuming you know what you're doing with that software!


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 19, 2011, 01:04:27 pm
Hi,
I've been thinking of another possible method, but first let me correct you about wireshark (or any other flavor of network packet sniffers), they don't read web pages, they intercept packets that run over the router. Obi is facing the internet however all the packets must go through the router.

The other possible method I was thinking would be to access and parse the data directly from the Obi unit. If the devs would show us how to root the device we could read and parse the data directly. I tried one method to see if I could analyze the file structure without success. I don't really want to risk bricking my Obi. It would be simpler to get the devs to show us the best way to achieve this using this more direct method.

Is you idea to get pop-ups from the Obi only, or from Asterisk in general?
You don't think the call history offers real time info which can be used for this design?


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on February 19, 2011, 03:17:38 pm
Hi,
I've been thinking of another possible method, but first let me correct you about wireshark (or any other flavor of network packet sniffers), they don't read web pages, they intercept packets that run over the router. Obi is facing the internet however all the packets must go through the router.

But that would only work if you were running Wireshark on the router.  I'm going to go out on a limb here and say that I think maybe it's you that doesn't fully understand Wireshark's capabilities (or lack thereof).  It would be a serious security risk if ANY user on a local network could run Wireshark and look at any and all traffic on the network.  I just don't believe you can run Wireshark on a computer and look at packets that are not flowing through that computer.  And you can tell me I'm wrong until your fingers are bleeding from typing it, but what you are saying doesn't make sense and therefore I don't believe it.

The other possible method I was thinking would be to access and parse the data directly from the Obi unit. If the devs would show us how to root the device we could read and parse the data directly. I tried one method to see if I could analyze the file structure without success. I don't really want to risk bricking my Obi. It would be simpler to get the devs to show us the best way to achieve this using this more direct method.

You know what would be simpler yet?  If they actually give us a way to get the notifications without having to do a bunch of tricky stuff that might break something.  I don't want to root the device!

Is you idea to get pop-ups from the Obi only, or from Asterisk in general?

Right now I'm looking for a way to get them from the OBi device.  Most OBi users won't be running Asterisk, you know!

You don't think the call history offers real time info which can be used for this design?

The Call History is no easier to access than the Call Status page, and the latter would provide much better and more useful information for this purpose.  However, as I explained in an earlier message, it's really beyond my abilities to pull the data off of that, because you first need to authenticate and then somehow run the JavaScript that appears to actually fetch the data.  And I know absolutely zilch about JavaScript (other than that it's a real nuisance at times).

QBZappy, may I just say, it seems to me you're kind of hijacking this thread with a lot of speculation and suggestions that aren't going to help most users, and definitely aren't helping me.  Wireshark is particularly irrelevant to this topic, and I wish you'd never brought it up.  I understand you're trying to be helpful, but at this point I'd really like to hear what others may have to say on the subject.


Title: Re: Support for notification popups on computers
Post by: jimates on February 20, 2011, 09:01:51 pm
someone mentioned an upcoming softphone, why can't it be that simple. A small program that runs in the system tray and connects to the corresponding Obi. The Obi sends the info to the app with that information.

Perhaps it could be configured with what info we want to show in the ballon. Maybe we just want name and number, but the app could actually save some or all the info that the call staus log has.


Title: Re: Support for notification popups on computers
Post by: 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


Title: Re: Support for notification popups on computers
Post by: jimates on February 22, 2011, 11:05:15 pm
It would also be great if we could link the PC softphone as an extension of the Obi. Instead of forwarding calls to it, it would be great if it would just ring along with the Obi.

That might also get the caller id to the pc.


Title: Re: Support for notification popups on computers
Post by: QBZappy on February 26, 2011, 05:40:05 pm
If anyone is interested here is an open source network caller ID (NCID) which can work with the Obi device. It is based on packet sniffing. Works with Linux, Mac, and Windows (using andlinux). Apparently it is safe to use a packet sniffing strategy on your own network.

http://ncid.sourceforge.net/

http://ncid.sourceforge.net/ncid/ncid.html#Screenshots

NCID is Caller ID (CID) distributed over a network to a variety of devices and computers.

NCID supports messages. Clients can send a one line message to all connected clients.

NCID supports outgoing calls if the information is provided by a SIP gateway.

NCID consists of the ncidd server, the ncid universal client, and various client output modules. It also includes NCID, SIP, and YAC gateways.


Another interesting product based on packet sniffing if you want to record incoming and outgoing calss. This one is commercial. Also captures CID. Not a popup app however.

http://www.miarec.com/products/miarec-solo/how-it-works


Title: Re: Support for notification popups on computers
Post by: sundansx on March 08, 2011, 06:19:12 pm
Anyone using ncid in a home network with the obi110?  I presume you would setup routing rules on your router to forward or Tee packets coming to the obi110 from the internet.  I am not sure how to do that on my Tomato firmware based router.  I didnt find any specific instructions on the internet, just conceptual one.  Thanks to all in this thread for the pointers thus far.


Title: Re: Support for notification popups on computers
Post by: QBZappy on March 08, 2011, 08:45:44 pm
sundansx,

Hi,

I have not had a need to set it up, however in this "how to" there is no mention of setting up routing rules. Author says "Run an ethernet cable from it (Hub) to the system running ncidsip and you're good to go!"

http://www.davidlaporte.org/tutorials/sipcallerid.html

I have used andlinux product. It is amazing to see linux running off a windows computer. It is just as intuitive as Windows, as it is GUI based.

I would be interested in knowing your results. Let us know.

PS
I read over the "How do I configure NCID to use a SIP gateway". I believe the ports you need to setup in the software are the:
SIP----> UDP port 5060 (Default setting) and perhaps the
RTP----> UDP port numbers mentioned in your config under Service Providers->ITSP Profile A/B->RTP->LocalPortMin & LocalPortMax

The rest of the discussion regarding using the "T" seems to be for testing for SIP packets using their sip2ncid application. This shouldn't be necessary since we know what ports the Obi is using by looking at the web config page.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 09, 2011, 03:37:11 am
sundansx,

Hi,

I have not had a need to set it up, however in this "how to" there is no mention of setting up routing rules. Author says "Run an ethernet cable from it (Hub) to the system running ncidsip and you're good to go!"

http://www.davidlaporte.org/tutorials/sipcallerid.html

QBZappy, with all due respect, this is NOT the solution most of us are looking for.  And the reason is in the paragraph above the one you quoted, which begins:

Quote
Option 2 is even easier, although it will involve an additional piece of equipment. You will need to purchase an ethernet hub and insert it between your cable/DSL modem and your router. If you have an all-in-one model, or are worried about the security implications of connecting a PC outside of your router/firewall, you can also just plug the hub into your router and your VoIP device and sip2ncid box into it. …
(emphasis added)

For me at least, it's not worth it to have yet another device that costs money, takes up space, consumes power, and requires a fair degree of computer knowledge to set up.  Do you think the average user is going to do this?  Not in a million years!  This is a serious nerd type project.  As far as it goes, many home users won't have a Linux box, won't want to try and install andlinux, and won't want to get involved with packet sniffing (even if they know what that is).  The whole point of these devices is to make VoIP relatively easy to set up and use, which for example is why Obihai gives us tools like the OBiTALK portal and the wizards - if you want to set up the device with one of their "known" providers, you don't even have to touch the configuration of the device.  But what you are suggesting goes way beyond that in terms of difficulty.

I personally wish that Obihai would consider including network Growl support.  In addition to the original Growl notification system for Mac OS X (http://growl.info/), there's also Growl for Windows (http://www.growlforwindows.com/gfw/) which is easy to install and becoming more popular (and in some ways more capable than the original Mac version).  Ans as I said in my original post, even Linux users aren't left out of the party, since they can use Mumbles to receive and display network Growl notifications (http://michigantelephone.wordpress.com/2010/07/18/how-to-receive-and-display-growl-network-notifications-using-ubuntu-linux/).

To give you an idea of how simple it can be to send Growl notifications, this is how it's done on an Asterisk system in Perl.  The bulk of this code is spent parsing the values passed by Asterisk (caller ID number, caller ID name, called extension number, and target IP address or MAC address of the computer to receive the notification) and then formatting the output.  Only the last few lines are actually used to send the notification:

Code:
#!/usr/bin/perl
use strict;
use warnings;
use Net::Growl;
use Asterisk::AGI;
my $agi = new Asterisk::AGI;
my %input = $agi->ReadParse();
my $num = $input{'callerid'};
my $name = $input{'calleridname'};
my $ext = $input{'extension'};
my $ip = $ARGV[0];

if ( $ip =~ /^([0-9a-f]{2}(:|$)){6}$/i ) {
        $ip = $agi->database_get('growlsend',uc($ip));
}

unless ( $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) {
    exit;
}

if ( $ARGV[2] ne "" ) {
        $ext = $ARGV[2];
}

my @months = (
    "January", "February", "March",     "April",   "May",      "June",
    "July",    "August",   "September", "October", "November", "December"
);
my @weekdays = (
    "Sunday",   "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday"
);
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";

# Next two lines normalize NANP numbers, probably not wanted outside of U.S.A./Canada/other NANP places
$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/;

register(host => "$ip",   
    application=>"Incoming Call", 
    password=>"$ARGV[1]", );
notify(host => "$ip",
    application=>"Incoming Call",
    title=>"$name",
    description=>"$num\nfor $ext\n$fulldate",
    priority=>1,
    sticky=>'True',
    password=>"$ARGV[1]",
    );

In addition to the above you do have to use a Perl module for network Growl support (Net::Growl (http://search.cpan.org/~nmcfarl/Net-Growl-0.99/lib/Net/Growl.pm)) but I believe there are similar modules for several other languages (you have to be careful, though, to get one that has network support - many Growl modules are intended only for sending notifications to the local machine). I do not know what language the Obihai developers code in, but unless it's a very low level language there's a possibility that there's an existing network Growl module.

According to the Net::Growl source code (http://search.cpan.org/CPAN/authors/id/N/NM/NMCFARL/Net-Growl-0.99.tar.gz), it was
Code:
# Derived from Rui Carmo's (http://the.taoofmac.com)
# netgrowl.php (http://the.taoofmac.com/space/Projects/netgrowl.php)
So apparently there's also a PHP module (http://the.taoofmac.com/space/Projects/netgrowl.php), and the author's comment on that code is very interesting:
Quote
This is the PHP version of netgrowl, which took me all of half an hour to do. With it, you can have your PHP-based web servers notify you instantly of any strange occurrences.
(emphasis added)

My point here is that although I'm not a programmer and therefore not in a position to really judge the difficulty of adding network Growl notifications, I honestly don't think that it would either be very difficult, nor require a huge amount of code.  Whether the Obihai developers would be willing to include it is a whole other matter, but given a preference I'd much rather see something like that than a solution that requires external hardware!



Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 09, 2011, 06:20:40 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):

Code:
#!/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!


Title: Re: Support for notification popups on computers
Post by: 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...)


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 09, 2011, 08:22:25 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.


Title: Re: Support for notification popups on computers
Post by: 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.)

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.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 09, 2011, 12:14:27 pm
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 (http://growl.info/documentation/developer/python-support.php) (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).  ::)


Title: Re: Support for notification popups on computers
Post by: plugger2 on March 10, 2011, 01:51:15 am

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


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 10, 2011, 04:46:28 am
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.)
>>> import Tkinter
>>>

That's all I got. No error message.


Title: Re: Support for notification popups on computers
Post by: plugger2 on March 10, 2011, 07:29:07 am
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.)
>>> 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!


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 10, 2011, 07:54:20 am
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!
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.


Title: Re: Support for notification popups on computers
Post by: plugger2 on March 10, 2011, 08:02:39 am
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!
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.


Title: Re: Support for notification popups on computers
Post by: plugger2 on March 14, 2011, 07:00:20 am
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.


Title: Re: Support for notification popups on computers
Post by: AndroidsOfTara on March 26, 2011, 01:56:09 pm
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!

Code:

#!/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;
}



Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 27, 2011, 12:38:49 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 (http://launchpad.net/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.

Code:
#!/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;
}
}
}


Title: Re: Support for notification popups on computers
Post by: oleg on March 27, 2011, 08:46:17 am
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  :)


Title: Re: Support for notification popups on computers
Post by: QBZappy on March 27, 2011, 07:42:17 pm
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.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on March 28, 2011, 03:02:56 am
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.


Title: Re: Support for notification popups on computers
Post by: MichiganTelephone on April 02, 2011, 06:56:50 am
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 (http://www.pbxinaflash.com/forum/showthread.php?t=4387) 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:

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="&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 (http://www.pbxinaflash.com/forum/showpost.php?p=62728&postcount=727)


Title: Re: Support for notification popups on computers
Post by: tmetro on July 26, 2011, 05:30:51 pm
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


Title: Re: Support for notification popups on computers
Post by: QBZappy on July 27, 2011, 08:56:22 am
Did you consider using one of the 8 gateways instead of using up one of the SIP accts?


Title: Re: Support for notification popups on computers
Post by: psichel on August 18, 2011, 08:40:14 pm
I have implemented notification popups for the Mac in Phone Amego by polling the callstatus page.

  http://www.sustworks.com/pa_guide/OBi110.html (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


Title: Re: Support for notification popups on computers
Post by: infin8loop on August 31, 2011, 08:10:22 am
I've seen the syslog approach to creating a pop-up mentioned but not implemented.  The attached is a "proof of concept" perl script that I hacked together.   There are some comments in the code.  If you are more proficient in perl than I am (which wouldn't take much!), feel free to use, improve, or do with it what you will.

infin8loop   


Title: Re: Support for notification popups on computers
Post by: bhasden on October 03, 2011, 01:15:02 pm
I put together a .NET application that sends out a Growl notification with the caller name and photo from your Google contacts. I've been using it for the last few days to display the caller id information on my HTPC and the laptops around the house. If anyone is interested, let me know. Thanks to everyone who provided information and scripts previously on this thread.


Title: Re: Support for notification popups on computers
Post by: TheBigMonkey on May 08, 2012, 09:19:36 am
I've seen the syslog approach to creating a pop-up mentioned but not implemented.  The attached is a "proof of concept" perl script that I hacked together.   There are some comments in the code.  If you are more proficient in perl than I am (which wouldn't take much!), feel free to use, improve, or do with it what you will.

infin8loop   

Thanks for the starting point. I made some changes. I'm no perl whiz but I was bored. Its only been tested with no name for callerID and usa phone number. It now uses an external script for extra convenience. Everything uses regex instead of position based stuffs. Eventually I want to have it connect to my Google contacts and match phone numbers to names (using gdata). It shouldn't be too difficult to have the picture on the popups as well. 

CID-notify-send is the script for notify-send and xbmc notifications.

gdata python client
http://code.google.com/p/gdata-python-client/


Title: Re: Support for notification popups on computers
Post by: infin8loop on May 08, 2012, 04:29:01 pm
Thanks for the starting point. I made some changes. I'm no perl whiz but I was bored. ....

Thanks for improving and sharing. I was bored and lazy (well, lazy is a given) at the time I put it together. My old brain hasn't fully embraced regex. I should have my secret decoder ring taken away.


Title: Re: Support for notification popups on computers
Post by: TheBigMonkey on May 08, 2012, 05:17:51 pm
Thanks for the starting point. I made some changes. I'm no perl whiz but I was bored. ....

Thanks for improving and sharing. I was bored and lazy (well, lazy is a given) at the time I put it together. My old brain hasn't fully embraced regex. I should have my secret decoder ring taken away.
My regex fu is weak I had a lot of trial and error and help from this site: http://txt2re.com/


Title: Re: Support for notification popups on computers
Post by: AlanB on December 18, 2013, 05:34:17 pm
For those of us who aren't programmers, is there a simple program that can do this.  Display caller id on the computer that is.

Thanks.


Title: Re: Support for notification popups on computers
Post by: Smee on December 18, 2013, 07:26:03 pm
Sure, Obi2Yac can.  Search the threads here or Google and you will find it.

Smee


Title: Re: Support for notification popups on computers
Post by: AlanB on December 23, 2013, 01:30:52 pm
Thanks.  I tried Obi2Yak.  Still a little more complicated than I wanted.

I ended up installing GrowlerID (http://riotouslabs.com/Products/GrowlerID (http://riotouslabs.com/Products/GrowlerID)).  Even though it's not supported, it worked great as a standalone application.


Title: Re: Support for notification popups on computers
Post by: GPz1100 on February 23, 2018, 01:54:36 pm
Did anything ever become of this?

It would be great to get a notification on the pc with the available CID information before deciding to get up and answer the phone.


Title: Re: Support for notification popups on computers
Post by: OBX1 on July 27, 2018, 08:19:23 am
Did anything ever become of this?

Working on this was my primary reason for joining the forum  ;D

There is a high end router product popular in Europe called "Fritzbox" which includes a caller ID server.  All you have to do is click a box in the routers web interface, and client applications on the network can use the specified IP/port to receive the Caller ID data.  So I wanted to see if I could do the same with Obi.  While the Obi firmware is powerful, its also a bit more complicated:

In the configuration panel you can enable the Obi to send system log event types of your choice to another device on the network that will decide what to do with the data.  The best solution I can find to receive and process the data is a caller ID server program called NCID (which specifically supports Obi devices through the 'Obi2ncid' module - see page 49 in the documentation.)

http://ncid.sourceforge.net/index.html

NCID will have to reside on a box that runs all the time (preferably something with low electricity usage, such as a small network file server, or a micro PC like the Raspberry Pi.)  This server app can import Caller ID data from multiple hardware & software sources, and relay it to any clients which register their interest.  Client apps are available for all major platforms:

The official client app (cross-platform Java app)
https://sourceforge.net/projects/ncid/files/ncidpop/

There are also various unofficial native clients for the major desktop & mobile platforms
http://ncid.sourceforge.net/addon.html

Of course, it would be a great selling point if NCID was integrated into the the Obi firmware so you dont need to set it up on another machine... but I am not very optimistic about anything of this nature: it appears that Polycom acquired Obi just to destroy what they perceive as a potential competitor -- it does not appear they did so because they wanted to improve the product.  But only time will tell.