Yealink Forums
Add photo to remote xml phonebook - Printable Version

+- Yealink Forums (http://forum.yealink.com/forum)
+-- Forum: IP Phone Series (/forumdisplay.php?fid=4)
+--- Forum: T4x Series (/forumdisplay.php?fid=31)
+--- Thread: Add photo to remote xml phonebook (/showthread.php?tid=4123)

Pages: 1 2


Add photo to remote xml phonebook - cadiken - 07-17-2015 01:28 AM

What is the syntax to add photos to the remote xml phone book entries on a T48G phone? I' have all the photos copied to a folder on the server where the RemotePhonebook.xml file is but they don't show up. I've added the name of the file as below:

<Unit Name="Test User" Phone1="1234" Phone2="" Phone3="" default_photo="Resource:picture.jpg"/>

Is this not the correct way?


RE: Add photo to remote xml phonebook - CWR - 07-17-2015 04:11 AM

If I recall, remote phonebook is downloaded to the device and used locally.
If that is the case - then Resource:picture.jpg would be looking for a local photo.

I use the older XML format. Didn't know that photos were possible...
See top of PDF page 3 here: http://www.yealink.com/Upload/T2X/T2X-V71/YealinkPhonebookGenerationTool-23371280292.zip
Talks about using built in images or copying to the device. Looks like you will use config:photo.jpg instead - but not sure how to get the files copied over.


Code:
<DirectoryEntry>
<Name>Aaron Lastname</Name>
<Telephone>145</Telephone>
</DirectoryEntry>



RE: Add photo to remote xml phonebook - cadiken - 07-17-2015 07:56 PM

I placed a few photos on a test phone and tried both resource:photo.jpg and config:photo.jpg and neither worked. I figured out that resource: is used for the default photos in the phone so that not working is understandable.

Anyone ever get photos to work on theirs without creating local contacts individually?


RE: Add photo to remote xml phonebook - cptjack - 07-18-2015 05:51 AM

Add or update these three parameters in your y000000000035.php file:
Code:
#Before using these parameters, you should store the desired resource files to the provisioning server.
#For more information, refer to Yealink SIP-T46G IP Phone Family Administrator Guide.
local_contact.data.url = http://server/voip/yealink/phonebook/ContactDataT48.xml
local_contact.image.url = http://server/voip/yealink/phonebook/ContactPhotoT48.tar
local_contact.icon.url = http://server/voip/yealink/phonebook/ContactPhotoT48.tar
The actual filenames are arbitrary, choose something that makes sense to you...
  • The first parameter will add the XML phonebook entries to your phone.
  • The second line will add the large photos which are shown during the call.
  • The last line adds the small icons that you see in the local addressbook.

The tar file is just an archive of all the photos you reference in the XML file. Just the pictures in BMP JPG or PNG format without any (sub)folders! You can use the same tar file for icons and photos as the pictures will be resized automatically.

ContactDataT48.xml has this format:
Code:
<?xml version="1.0" encoding="utf-8"?>
<root_group>
    <group display_name="All Contacts" ring="" />
    <group display_name="Blacklist" ring="" />
</root_group>
<root_contact>
    <contact display_name="Test1" office_number="2510" mobile_number="2511" other_number="3610" line="1" ring="" group_id_name="All Contacts" default_photo="Config:test.jpg" />
    <contact display_name="Test2" office_number="3510" mobile_number="3511" other_number="3620" line="2" ring="" group_id_name="Blacklist" default_photo="Config:blocked.jpg" />
    <!--
    default_photo="" Only T46 supports!
    -->
</root_contact>

Tested on my T48G with the latest 35.73.0.50 firmware.



Alternatively, you can also add a SIP Header, that will display the picture you specify in the URL. I use this in Asterisk dialplan for adding a picture to a number that is NOT in the local directory:
Code:
same => n,SIPAddHeader(Call-Info: <http://server/voip/callerid.php?num=${CALLERID(num)}>\;purpose=icon)

Then create a php script that outputs a picture depending on the CallerID provided:
PHP Code:
<?php
    $db 
= new PDO('mysql:host=myserver;port=myport;dbname=mydatabase;charset=utf8''myuser''mypassword');

    
$accountid 1;
    
$number $_GET['num'];
    
// Number are stored in international format. Convert local numbers:
    
if (substr($number,0,2)=="00") { $number "+" substr($number,2,strlen($number)-2); }
    if (
substr($number,0,1)=="0") { $number "+44" substr($number,1,strlen($number)-1); }
    
        
$query $db->prepare("SELECT * from callerid where accountid=:accountid AND number=:number AND not isnull(picture);");
        
$query->execute(array(':accountid'=>$accountid,':number'=>$number));
        
$data $query->fetchAll(PDO::FETCH_ASSOC);
    
    if (
count($data)>0) {
        
$ImageDataLength strlen($data[0]['picture']);
        
        
header("Content-type: image/jpeg") ;
        
header("Content-Length: ".$ImageDataLength);
        echo 
$data[0]['picture'];
    } else {
        
header("location:nopicture.jpg");
    }
?>

For details, check out this thread. Tested on T38G and T48G phones.


RE: Add photo to remote xml phonebook - cadiken - 07-21-2015 09:23 PM

Thanks for the detailed response cptjack, I appreciate it.

So loading local phonebook should work? Does the path to the photos and xml file matter (local_contact.data.url = http://server/voip/yealink/phonebook/ContactDataT48.xml)? Do the files have to be the same server that the .php config file resides on?

One more question. Is the default photo="" supported on T48G with firmware 35.73.0.50?

Going to test this today.


RE: Add photo to remote xml phonebook - cptjack - 07-22-2015 04:30 AM

You are welcome cadiken. The XML and TAR files can be on any webserver that is accessible by the phone. My suggestion would be to start with a couple of entries and photo's and work from there, using the example provided.

I tested the examples on a T48G with 35.70.0.50 firmware, so you should be good to go! Contrary to the documentation, T48 is also supported.


RE: Add photo to remote xml phonebook - cadiken - 07-24-2015 05:25 AM

I got the xml file loading properly but the images will not load to the phone during auto provisioning. Is there something I'm not doing? just added the two lines:
local_contact.image.url = http://server/Photo.tar
local_contact.icon.url = http://server/Photo.tar

and updated the line:
local_contact.data.url = http://server/Localphonebook.xml


RE: Add photo to remote xml phonebook - cptjack - 07-24-2015 06:00 AM

Do you see the files being downloaded correctly (status 500) in the log of the webserver?
If you use the web interface to edit the contacts, are the pictures there to select?
It can be an issue with the xml or the tar file, so trying to eliminate which one to look at...
Maybe you can post an example of your files or send me a PM and I'll try them on my T48 to see if I can pinpoint the problem.


RE: Add photo to remote xml phonebook - cadiken - 07-24-2015 07:46 PM

I sent you a PM cptjack and included the files.

I only see the xml file being downloaded. I explained more in the PM.
Thanks for your help.


RE: Add photo to remote xml phonebook - cptjack - 07-25-2015 05:31 AM

Hi cadiken, I send you an email.

The XML file shoud have default_photo="Config:" instead of default_photo="Resource:"
The photos.tar loads correctly, so that should be OK.
Also check for duplicate local_contact.xxx.url lines in your y000000000035.cfg file on the provisioning server.

Best regards,
/CJ