login | register
Wed 08 of Oct, 2008 [00:28 UTC]

voip-info.org

History

Polycom XML browser scripts for asterisk

Created by: chariga,Last modification on Sun 27 of Apr, 2008 [18:50 UTC] by gcohn
Image
Polycom XML browser scripts

Simple php scripts for parked calls, meetme rooms, sip users, queues list and peers status.
Please see attachment (click on the question mark on the left).

See Also


Here's a simple php script adapted from the Asterisk FOT book that will grab the XML page from your local NOAA weather station and display a few lines of info on your Polycom.

Image
Polycom microbrowser weather script

The file is a word.doc where I took some screen shots of the view source in IE and a picture of the phone display. Underneath the phone display picture is the php code. Just copy all of the code from the <? to ?> tags and paste into notepad and save as weather_phone.html. Upload it to the home page of your web server and make sure the permissions are set to 644 and it is owned by your usual web page owner.

You can test it by navigating to your URL with IE and then doing a show page source. It should look like the source above the phone picture in the document and be formatted properly for the microbrowser in Polycom.

Then set the URL of your microbrowser to http://www.yourwebsite.com/weather_phone.html and set the refresh time to something reasonable like 900 or 1800 so it will refresh every 15 or 30 minutes if you put it on the idle screen. I wouldn't refresh any faster than that because each time it refreshes, it has to go out to the NOAA weather station site and download the latest XML file and you don't want to be hitting their server every few seconds.

You must change the name of the weather station in the php script to one in your locale. A web page to search for them is here: http://lwf.ncdc.noaa.gov/oa/climate/stationlocator.html Change the KTUS in the line $weatherURL="http://www.nws.noaa.gov/data/current_obs/KTUS.xml"; to the name of your local weather station as found by the NOAA URL above.

Feel free to clean up the php code as you see fit, this was a quick and dirty hack. I just copied it from the AGI application on my Asterisk server, deleted the stuff that normally makes it say the weather and added a few lines to print to the screen in a web browser instead. I'm not a programmer but I understand enough code to be able to modify someone elses scripts. ;-)

gwcohnatsimplybits.net

Comments

Comments Filter
222

333Re: A little Help???

by gcohn, Friday 23 of May, 2008 [02:44:41 UTC]
Also, remember that to run AMI programs, Asterisk has permissions that are controlled by the manager.conf file. In the first set of scripts on this page, only the show parked calls will run without permissions. For the rest of the scripts to run, you need to make the manager.conf file look something like this:

 general

 enabled = yes
 port = 5038
 bindaddr = 127.0.0.1

 myuser
 secret=123456
 read = all,system,call,log,verbose,command,agent,user,config
 write = all,system,call,log,verbose,command,agent,user,config
 bindaddr = 192.168.1.4 ; address of your server

 (Adjust the read and write permissions to your preferences, I had them all turned on to test.)
myuser is the username and 123456 is the password.  You will have to enter these in the scripts where it asks for them.

When the scripts run, they authenticate with the manager.conf to see if they have the required permissions to run the commands and      create output.  

The weather script doesn't run as an AMI script so it is unaffected by permissions in the manager.conf.
222

333Re: A little Help???

by tomislav, Thursday 23 of March, 2006 [13:17:45 UTC]
Check permissions.. (owner, etc..) which apache version you're running? What does http log say?
222

333Re: A little Help???

by tomislav, Thursday 23 of March, 2006 [12:57:33 UTC]
Check permissions.. (owner, etc..) which apache version you're running? What does http log say?
222

333

by tomislav, Thursday 23 of March, 2006 [12:53:35 UTC]
Please correct link in index.html from:

<a href="/sipphones/index.php">Phone Status</a>

to..

<a href="sipphones.php">Phone Status</a>


222

333A little Help???

by dstroot, Saturday 18 of February, 2006 [19:46:00 UTC]
I put the scripts in my www/html folder and made them executable - I also changed my id and password. Doesn't work. Just a *little* help would be appreciated!