Yealink Forums
Push XML on T38G - Printable Version

+- Yealink Forums (
+-- Forum: IP Phone Series (/forumdisplay.php?fid=4)
+--- Forum: Phone specific topic (/forumdisplay.php?fid=12)
+---- Forum: T3xP Series (/forumdisplay.php?fid=22)
+---- Thread: Push XML on T38G (/showthread.php?tid=3269)

Push XML on T38G - ruffle - 02-06-2015 12:07 AM


I'm trying to use push XML on a T38G. Pushing a YealinkIPPhoneTextScreen works fine but pushing a YealinkIPPhoneImageScreen doesn't Sad

The XML I'm sending is:

<?xml version="1.0" encoding="UTF-8"?>
<YealinkiPPhoneImageScreen Beep="no" mode="fullscreen">

The phone says 'Load Image please wait", the screen shows the line buttons on the right and just 'Exit' on the bottom line with a different background to normal. There's no image displayed though Sad

If I use the exact same xml in a XML Browser DSS key the image is displayed correctly in fullscreen mode.

The push XML is being sent by a php script copied from the Yealink manual and as I said, works with a TextScreen.

The phone's running version

Any ideas?

Also... can one push or pull images in a loop? On the Snom 870's we've got, the idle screen shows 1 second snapshots of the entrance camera by simply pulling the image, waiting 1 second and pulling the image again and I'd like to do this on the Yealink T38G. Can this be done?

RE: Push XML on T38G - ModCraig - 02-06-2015 02:21 AM

The T38 has a screensaver mode that you can load several photos. I tried it for a time but the phones kept "running out of memory" so I reset them to factory and reprovisioned without.

RE: Push XML on T38G - ruffle - 02-06-2015 05:15 PM

Yes... but I'm not trying to display preset photos as a screen saver. I want to push/pull stills from the office entrance camera either as a 'screen saver' when it's idle (as I do on Snom 870's) or pushed to the phone when someone comes through the door (external trigger).

If the T38G would accept a YealinkIPPhoneImageScreen from a push XML I could display one frame at least.

I notice that there is an XML Idle Screen and URL on the Account page of the T38G but turning that on and providing a URL to a TextScreen XML file seems to have no effect - the phone doesn't fetch the XML at the end of a call. Anyone got any ideas what this is for and how you use it?

RE: Push XML on T38G - cptjack - 02-06-2015 10:15 PM

It seems like you have the same issue that I encountered a while ago; static images do get displayed correctly, but dynamic images don't. It took me quite a while to realize that the Yealink T38G phone needs to have the Content-Length header set or the image won't be displayed...

I solved this with a PHP script by adding the appropriate Content-Length header to the output like this:
PHP Code:

$src imagecreatefromjpeg("http://ipcamera/snapshot.cgi");
imagecopyresampled ($dst$src000imagesx($dst), imagesy($dst) , imagesx($src), imagesy($src));

// Yealink phone needs the Content-Length header
// Get the Image Data Length
ob_start(); // start a new output buffer
imagejpeg$dst""90 );
$ImageData ob_get_contents();
$ImageDataLength ob_get_length();
ob_end_clean(); // stop this output buffer

//header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($fn)).' GMT', true, 200);
header("Content-type: image/jpeg") ;
header("Content-Length: ".$ImageDataLength);

// Free up memory

So you will need an intermediate script, if the camera doesn't have the Content-Length header by default. I hope this solves your problem as well. Please, let us know if it does or not Smile

RE: Push XML on T38G - ruffle - 02-07-2015 01:24 AM

Thanks for that suggestion but the camera does provide the content length in the header like so:

# wget -S
           => `image.cgi.1'
Connecting to connected.
HTTP request sent, awaiting response...
  HTTP/1.0 200 OK
  Cache-Control: no-cache
  Pragma: no-cache
  Expires: Thu, 01 Dec 1994 16:00:00 GMT
  Connection: close
  Content-Type: image/jpeg
  Content-Length: 45018
Length: 45,018 (44K) [image/jpeg]

100%[========================================================>] 45,018        --.--K/s            

16:59:15 (6.51 MB/s) - `image.cgi' saved [45018/45018]

I did try passing your php script in my push XML and that had the same result as all my other attempts... a beep, the phone says "Load Image, Please Wait" but no image is displayed.

This really is quite frustrating as when using a DSS key to pull the XML with the identical link to the camera, the image gets displayed Sad

RE: Push XML on T38G - cptjack - 02-07-2015 01:38 AM

OK, I did some digging in the way I set this up... and it's a chain of files.

Asterisk triggers a SIP notify message, but a push XML should work too:
Content=><YealinkIPPhoneExecute Beep="yes">
Content=><ExecuteItem URI="http://serverip/yealink/ipcambig.xml"/>

Then the ipcambig XML file contains:
<YealinkIPPhoneImageScreen doneAction="" Beep="no" Timeout="30" LockIn="no" mode="fullscreen">
<Image horizontalAlign="right" verticalAlign="top">http://serverip/yealink/tobmp.php</Image>

RE: Push XML on T38G - ruffle - 02-07-2015 02:42 AM

Aha! A Result.

Using YealinkIPPhoneExecute kind of like you did above, the image gets displayed. For the record here are the bits that work should anyone else get stuck.

The php that's used to push the XML to the phone (just run with "php <filename>" on the system you've allowed to be the push XML server in the phone's config):

function push2phone($server,$phone,$data)
$xml = "xml=".$data;
$post = "POST / HTTP/1.1\r\n";
$post .= "Host: $phone\r\n";
$post .= "Referer: $server\r\n";
$post .= "Connection: Keep-Alive\r\n";
$post .= "Content-Type: text/xml\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
$fp = @fsockopen ( $phone, 80, $errno, $errstr, 5);

        if($fp) {
                fputs($fp, $post.$xml);

$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<YealinkIPPhoneExecute Beep="no">';
$xml .= '<ExecuteItem URI=""/>';
$xml .= '</YealinkIPPhoneExecute>';



and the xml file (yealink-cam.xml) that the phone then pulls:

<?xml version="1.0" encoding="UTF-8"?>
<YealinkiPPhoneImageScreen Beep="no" mode="fullscreen">

Many thanks for suggesting YealinkIPPhoneExecute. There's obviously a bug in the T38G when pushing image screens but the above will work for my purposes.

RE: Push XML on T38G - cptjack - 02-07-2015 03:27 AM

Yes, there are more 'brainteasers' like that in the firmware. It's been a while since I figured it out. But most importantly it works! Big Grin

RE: Push XML on T38G - grawil - 06-17-2016 07:38 AM

Did you ever get this working? I'm interested in doing something similar with a T32g.