What is the best way of using this?
Thank you
Any recomendations on how to use Microbrowser ?
i've come up with a weather script... put it in your cgi-bin folder, make it executable, and install the necessary Perl module.
grr. i don't know why the bits are being added... you'll have to remove all those first.
#!/usr/bin/perl -U
#############################################################
# Polycom MicroBrowser IDLE Page
# Written by Tim Schreyack
#
#############################################################
# Install the Weather module:
# perl -MCPAN -e 'install Weather::Com'
# For more info: <a href="http://search.cpan.org/~schnueck/Weather-Com-0.5.3/" title="http://search.cpan.org/~schnueck/Weather-Com-0.5.3/">http://search.cpan.org/~schnueck/Weather-Com-0.5.3/</a>
use Weather::Com::Finder;
use Weather::Com::CurrentConditions;
use Weather::Com::Location;
use Weather::Com::Cached;
use Weather::Com::Forecast;
# Get your IDs from weather.com and put them, you can find more info in the Weather
# module documentation
$PartnerID = "";
$LicenseKey = "";
%config = (
partner_id => $PartnerID,
license => $LicenseKey,
timeout => 0,
debug => 0,
language => 'en',
units => 's',
cache => '/var/www/cache',
);
$weather_finder = Weather::Com::Finder->new(%config);
#@locations = $weather_finder->find('Lexington, MA'); #Finds 1 Location
#@locations = $weather_finder->find('Lexington'); #Finds All Locations with Lexington
#@locations = $weather_finder->find('03104'); #Finds Locations By Zip Code
@locations = (
$weather_finder->find('Lexington, MA'),
);
$x=0;
print qq~Content-Type: text/html\n\n<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="refresh" content="30"/>
<title>$city Weather</title>
</head>
<body>
<table border="0">
<tbody>
~;
foreach $location (@locations)
{ $conditions = $locations[$x]->current_conditions();
$forecast = $locations[$x]->forecast();
$City = $location->name();
#$Localtime = $location->localtime();
#$Sunrise = $location->sunrise();
#$Sunset = $location->sunset();
#$TimeZone = $location->timezone();
#$Humidity = $conditions->humidity() . "%";
#$ID = $conditions->id(); #USMA0046 = Logan Airport = Boston, MA
#$Dewpoint = $conditions->dewpoint();
#$Icon = $conditions->icon(); #Icon Downloadable via SDK on Website
#$LastUpdate = $conditions->last_updated();
#$Observatory = $conditions->observatory(); #Typically an Airport, Dam or Gov Facility
#$Pressure = $conditions->pressure();
$TempF = $conditions->temperature() . $locations[$x]->units()->temperature();
#$Name = $conditions->name(); #Same as location->name
#$UVIndex = $conditions->uv_index();
#$Visibility = $conditions->visibility() . $locations[$x]->units()->distance();
#$Wind = $conditions->wind()->speed() . $locations[$x]->units()->speed() . " " . $conditions->wind()->direction_short();
#$WindDirSht = $conditions->wind()->direction_short(); #N, NW, E, NNE...
#$WindDirLng = $conditions->wind()->direction_long(); #North, East, Southwest...
#$WindDirDeg = $conditions->wind()->direction_degrees(); #0, 150, 30, 45...
#$WindChill = $conditions->windchill() . $locations[$x]->units()->temperature();
#$locations[0]->units()->distance();
#$locations[0]->units()->precipitation();
#$locations[0]->units()->pressure();
#$locations[0]->units()->speed();
#$locations[0]->units()->temperature();
#$forecast = $locations[0]->forecast();
#$tomorrow = $forecast->day(1);
#print "Forecast for tomorrow:\n";
#print " - tomorrow it's the ", $tomorrow->date()->date(), "\n";
#print " - sunrise will be at ", $tomorrow->sunrise()->time(), "\n";
#print " - maximum temperature will be ", $tomorrow->high(), "\n";
$today = $forecast->day(0);
$tomorrow = $forecast->day(1);
print qq~~;
$City =~ s/,.*//gi;
$today_high = $tomorrow->high();
$today_low = $tomorrow->low();
$today_day_conditions = $tomorrow->day()->conditions();
$today_night_conditions = $tomorrow->night()->conditions();
$tomorrow_high = $tomorrow->high();
$tomorrow_day_conditions = $tomorrow->day()->conditions();
$tomorrow_night_conditions = $tomorrow->night()->conditions();
$update_time = $location->current_conditions()->last_updated()->time();
$update_date = $location->current_conditions()->last_updated()->formatted('mm-dd-yyyy');
print qq~
<tr>
<td>Current:</td>
<td>$TempF</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Hi/Low:</td>
<td>$today_high / $today_low</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Today:</td>
<td colspan="3">$today_day_conditions</td>
</tr>
<tr>
<td>Tonight:</td>
<td colspan="3">$today_night_conditions</td>
</tr>
<tr>
<td>Tomorrow:</td>
<td colspan="3">$tomorrow_day_conditions</td>
</tr>~;
$x++;
}
print qq~</tbody>
<tfoot>
<tr>
<td colspan="4" align="center">Updated: $update_time $update_date </td>
</tr>
</tfoot>
</table></body></html>~;
I have a set of 5 scripts for Company Directory, Customer Directory [From Proprietary Database], List Parked calls, Weather and Stock Quotes. All but the customer one I use for customer installs.
schreyack,
Thank you for sharing
pkaplan,
Could I get a copy?
Thanks
pkaplan - share! please!
I know I listed this once before:
www.exceptionalit.com/polycom.zip
The only changes you should have to make is in the _config.php file.
Let me know if you run into any trouble with it.
Cool! Thanks.
Can you explain what is this for. is it for use with the phones... i have never heard of this.
thank you
rrichiez
Thank you very much.
Absolutely beautiful, the parked call list is a huge help! It should be part of the Polycom TB package!
Does anyone know if there is a way to make this auto-refresh?
g
While I didn't dig deep into the Microbrowser commands, I tried to get it to auto-refresh and the micro browser would not allow it.
In addition to parked calls, it would be useful to be able to see the extensions that are on the phone or busy in some other way.
I haven't worked with Asterisk's manager before but I'm trying to see how to get the right data out of it.
g
gfamiglio,
If you have presence turned on and set up a contact directory it will do that for you already.
pkaplan,
The main time I want to check if someone's on a call is right before I try to transfer a call to them. The buddy option shows if the contacts are online. However, you can't get at this feature while *ON* a call. Which makes this feature almost useless to me.
I put together a small xml page in php to show the online call status of a few extensions, and if selected dial that extension. The only catch is that the page doesn't refresh automatically and I have to select the "refresh" soft key to update it to the current status.
If Polycom put an option to get to the buddies screen while on a call this would be much better.
With limit screen space, limited colours, and back lighting not always available XML applications on a phone have some harsh realities.
There *is* a place for XML applications on a phone. And also for desktop integration. It's always great to see the cool things other people come up with. It's like a box of lego.
-- James Bennett
www.jebsolutions.com
James,
You make a good point about accessing during a call.
To work with your metaphor, it's better than lego because every time someone builds something fun to play with, the box of parts gets more full instead of less full. ;)
So basically you're saying that programmers are just full of it? :)
-- James
Hello,
Does anybody have a copy of this script today? The link above is no longer active. I would really appreciate a copy of it.
Please PM me.
Thanks, Blake
Here is a modified version of what I think you were looking for, I have this displayed on each phone in my office as the idle display... its refreshed every 5 seconds.
I do this via a Cron job, that runs this script outputted to a static page that the phones render.
Its a work in progress, with the newest firmware the display needs a little tweaking that I haven't gotten to yet.
George
<?php
// Asterisk Display for Polycom Phones
//
// Written by Peter Kaplan
// Modified by ae3145
//
// This is barely tested, use at your own risk.
// It works with a standard 2.0 trixbox install.
//
$API_PORT=5038;
$API_USER="USERNAME";
$API_PASS="PASSWORD";
echo "<html><body>\n";
echo "Parked Calls:\n";
exec( "asterisk -r -x 'DATABASE GET DAYNIGHT C0'", $response);
$NightMode = (str_replace ( "Value: ", "", $response[0]));
if($NightMode == "NIGHT")
{
echo "<p><b>After Hours Mode.</b></p><p><b>Dial: *280 to Disable.</b></p>";
// echo "<img src=\"moon.bmp\" height=\"50\" width=\"50\" />";
}
else
{
exec( "asterisk -r -x 'DATABASE GET DAYNIGHT C1'", $response);
$MeetingMode = (str_replace ( "Value: ", "", $response[1]));
if($MeetingMode == "NIGHT")
{
echo "<p><b>Staff Meeting Mode.</b></p><p><b>Dial: *281 to Disable.</b></p>";
}
}
$fp=fsockopen( "127.0.0.1","5038",$errno,$errstr,2);
if (!$fp) // Error Handling. Otherwise PHP will fill logs with connection errors when socket is closed.
{
echo "<p><br />There Was A Connection Error:</p><p> $errstr ($errno)</p>\n";
$numberparked=-1;
}
else {
// echo "Parked Calls:\n";
fputs($fp,"Action: login\r\n");
fputs($fp,"Username: ".$API_USER."\r\n");
fputs($fp,"Secret: ".$API_PASS."\r\n");
fputs($fp,"Events: off\r\n");
fputs($fp,"\r\n");
fputs($fp,"Action: parkedcalls\r\n");
fputs($fp,"\r\n");
$exten='';
$timeout=0;
$numberparked=-1;
$started=false;
while (!feof($fp))
{
$line=fgets($fp, 128);
$line=str_replace("\n","",$line);
$line=str_replace("\r","",$line);
// echo $line;
if(strlen($line)<5)
{
//an record has ended
if($started)
{
if(($calleridname == " device") | ($calleridname == " Unknown Caller") | ($calleridname == " "))
{
if($callerid == " ")
{
echo '<br>'.$exten." - Unknown Caller</br>\n";
} else {
echo '<br>'.$exten." - ".$callerid."</br>\n";
}
} else {
$calleridname=str_replace("&","n",$calleridname);
echo '<br>'.$exten." - ".ucwords(strtolower($calleridname))." -".$callerid."</br>\n";
}
}
$exten='';
$channel='';
$timeout='';
$callerid='';
$calleridname='';
}
if(strpos($line,"Event: ParkedCall") !== false)
{
$started=true;
$numberparked=$numberparked+1;
}
if(strpos($line,"Exten: ") !== false)
{
$pieces=explode(":",$line);
$exten=str_replace("\n","",$pieces[1]);
}
if(strpos($line,"Channel: ") !== false)
{
$pieces=explode(":",$line);
$channel=str_replace("\n","",$pieces[1]);
}
if(strpos($line,"Timeout: ") !== false)
{
$pieces=explode(":",$line);
$timeout=str_replace("\n","",$pieces[1]);
}
if(strpos($line,"CallerID: ") !== false)
{
$pieces=explode(":",$line);
$callerid=str_replace("\n","",$pieces[1]);
}
if(strpos($line,"CallerIDName: ") !== false)
{
$pieces=explode(":",$line);
$calleridname=str_replace("\n","",$pieces[1]);
}
if (strpos($line,"ParkedCallsComplete") !== false)
{
fputs($fp,"Action: logoff\r\n");
fputs($fp,"\r\n");
fclose($fp);
break;
}
}
}
if ($numberparked == 0 )
{
echo "<p></p><p>There are no calls waiting.</p><p>During a call, press <i>More</i>, and then the <i>Park</i> key
to park a call.</p>";
}
echo "</body>\n</html>";
?>
@pkaplan
Do you still have theese scripts ??
Your link is broken.
I am looking for a script that pulls some phonenumbers from a mysql database, and shows them on the screen to be dialed.
The phone is a Polycom 650.
Cheers
I just remember, that some months back, I wrote a script(s) to pull down the contacts from a users contacts folder stored on exchange server, and have it displayed on the 3.0.x series polycoms firmware.
I run pbx in a flash, and a windows 2003 server with IIS and exchange on the windoze box....
I too would like these to be reposted. A company directory is a "must have" in a large environment.
I too would like these to be reposted if possible. A company directory is a "must have" in a large environment.
is there a way to attach a file to a post?
unfortunately no. you could pastebin it if it's not too big.
I'm still pretty much a newbie when it comes to xml authoring and such. I want to use the weather script that Schreyack posted at top. I was able to install the module and I got a id and license from weather.com. But i'm not sure what he means by make it executable, and what would I use for a path the file when I make it and put it in the cgi-bin?
Thanks,
Member Since:
2006-05-31