Support for notification popups on computers
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):
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!
plugger2:
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.
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). ::)
Navigation
[0] Message Index
[#] Next page
[*] Previous page