Yealink Forums

Full Version: XML Idle screen
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can anyone tell me how to do an XML Idle Screen - say for weather?
There is a website that does free for Cisco - but obviously I will have to create my own:
http://www.singlewire.com/free-xml-apps.html
Hi craigreilly,

You can refer to below forum post.

http://forum.yealink.com/forum/showthread.php?tid=1160
I guess my question was not clear... How do I even get the data? And create the XML file.
I can't create a static file - it will always be wrong...
You can refer to XML Browser user guide and some sample xml files.
Using XML Browser Feature on Yealink phones Rev_70.0
Maybe I need a programmers forum... I've read the guide... All is says is
"Users can customize practical applications, such as weather report, stock information, Google search and news service, etc."
It doesn't tell how to get dynamic content into the XML.
You will need to do several steps to accomplish this.

Here is how I would go about it.
Maybe someone else can come up with another idea.

First, you need to know how to use PHP or another Scripting Language
Your script would need to go to a web site that has XML Data for the weather like this one: http://w1.weather.gov/xml/current_obs/KBCT.xml
Then you need to look at the Page Source Code and Parse out the Elements that you are interested in:
<weather>Fair</weather>
<wind_string>North at 8.1 MPH (7 KT)</wind_string>
<wind_dir>North</wind_dir>
<wind_degrees>360</wind_degrees>
<wind_mph>8.1</wind_mph>
<wind_kt>7</wind_kt>
<pressure_in>30.07</pressure_in>

Then assign each Parsed Element a Variable Name:
$wind = "8.1"
$pressure = "30.07"

Then insert that Variable into your script to be sent to the phone.
<Line Size="small">Wind Speed:> $wind </Line>
<Line Size="small">Pressure:> $pressure </Line>

This code may not be syntax correct, but it just a concept of what needs to be done.

I hope this gets you started in the right direction.
Below is script I made.

You can change the script for different Weather Locations by going here: http://w1.weather.gov/xml/current_obs
Then select a state and look at the "Call Signs" for the different locations.

Example:
California
Auburn Muni Airport (KAUN)
Avalon, Catalina Airport (KAVX)
Bakersfield/Meadows (KBFL)
"Call Signs" are KAUN, KAVX and KBFL.

Then change the line in the script where KAVX is located to your new choice.
Then in your Yealink DSS Key programing area, make one of the DSS buttons "XML Browser" and put in the Server info where you are going to have the script.

To make it an Idle Screen, I am not 100% sure how to do it.
But you can use an "Action URL" like "On Hook" and put in the Server info where you are going to have the script.
That way when you hang up on a call, the Action URL "On Hook" sends the request for the script automatically.

GetWX.php

<?php

// GetWX.php

//Get XML from web page
$url = "http://w1.weather.gov/xml/current_obs/KAVX.xml" ;
$xml = simplexml_load_file($url) ;

//Parse out fields
$temp = $xml->temp_f ;
$weather = $xml->weather ;
$humidity= $xml->relative_humidity ;
$wind_dir= $xml->wind_dir ;
$wind_mph= $xml->wind_mph ;
$location= $xml->location ;

//Push to Phone
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>".
"<YealinkIPPhoneFormattedTextScreen Beep=\"yes\" Timeout=\"10\" LockIn=\"no\">".
"<Scroll>".
"<Line Size=\"normal\" Align=\"center\"> $location </Line>".
"<Line Size=\"normal\"> Weather: $weather </Line>".
"<Line Size=\"normal\"> Temperature: $temp </Line>".
"<Line Size=\"normal\"> Humidity: $humidity </Line>".
"<Line Size=\"normal\"> Wind Dir.: $wind_dir / $wind_mph MPH</Line>".
"</Scroll>".
"</YealinkIPPhoneFormattedTextScreen>";

?>
Thank you! I thought the T46 had an XML Idle screen option - but it seems I was confusing it with the T38.
Reference URL's